lokale Variable ecio-40,18f8722

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

lokale Variable ecio-40,18f8722

Post by saschech@gmx.de »

Hallo Benj

a long time i work on a new problem vor me:

inside a macro,if i work with e.g.:
RS_out.rs_out = RS_out.rs_out OR 0b00001000
RS_out.rs_out = RS_out.rs_out AND 0b11110111
output to pord d
Macro end

it works ok in flowcode simulation (with all 8 bits), but not if i download it to my board with 18f8722
the thame with ecio-40

inside a macro,if i work with e.g.:
rs_out_port = rs_out_port OR 0b00001000
rs_out_port = rs_out_port AND 0b11110111
output to pord d
Macro end

it work also on my board and ecio-40

the only difference for me : first i use a lokale variable ; second i use a globale variable

what going wrong?

Regards wolfgang

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: lokale Variable ecio-40,18f8722

Post by saschech@gmx.de »

Hallo
To reminiscence.

Regards Wolfgang

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: lokale Variable ecio-40,18f8722

Post by saschech@gmx.de »

Hallo together.

Must i live with this?

Regards wolfgang

User avatar
Steve
Matrix Staff
Posts: 3426
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: lokale Variable ecio-40,18f8722

Post by Steve »

Hello Wolfgang,

Sorry for missing this - I'll try to look into it tomorrow.

User avatar
Steve
Matrix Staff
Posts: 3426
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: lokale Variable ecio-40,18f8722

Post by Steve »

Sorry - it was a long "tomorrow"!

I've recreated your program and I can't see the problem. The C code generated is exactly the same if you use a local variable or a global variable. Perhaps there is something else wrong here.

Remember that a local variable does not retain its value after the macro has finished. Or perhaps you are setting its value wrong in the first place?

If you are still having problems with this, please post your program (fcf + the generated c file) and I'll look at it.

saschech@gmx.de
Posts: 714
Joined: Wed Jan 31, 2007 12:41 pm
Has thanked: 1 time
Been thanked: 26 times
Contact:

Re: lokale Variable ecio-40,18f8722

Post by saschech@gmx.de »

Hallo Steve

"local variable does not retain its value after the macro has finished"
This i have not considered.Is this externally flowcode the thame (c programming)?

Regards wolfgang

User avatar
Steve
Matrix Staff
Posts: 3426
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: lokale Variable ecio-40,18f8722

Post by Steve »

Yes - the same is true in C and in other programming languages.

Although in some languages, you can have "static" local variables which cannot be "seen" outside of the function, but do retain their value between function calls.

Post Reply