Page 1 of 1

lokale Variable ecio-40,18f8722

Posted: Tue Dec 30, 2008 10:37 am
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

Re: lokale Variable ecio-40,18f8722

Posted: Tue Jan 13, 2009 9:07 am
by saschech@gmx.de
Hallo
To reminiscence.

Regards Wolfgang

Re: lokale Variable ecio-40,18f8722

Posted: Mon Jan 26, 2009 4:08 pm
by saschech@gmx.de
Hallo together.

Must i live with this?

Regards wolfgang

Re: lokale Variable ecio-40,18f8722

Posted: Mon Jan 26, 2009 5:05 pm
by Steve
Hello Wolfgang,

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

Re: lokale Variable ecio-40,18f8722

Posted: Thu Jan 29, 2009 9:14 am
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.

Re: lokale Variable ecio-40,18f8722

Posted: Thu Jan 29, 2009 11:03 am
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

Re: lokale Variable ecio-40,18f8722

Posted: Thu Jan 29, 2009 2:05 pm
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.