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
lokale Variable ecio-40,18f8722
-
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
- Contact:
-
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
- Contact:
-
- Posts: 714
- Joined: Wed Jan 31, 2007 12:41 pm
- Has thanked: 1 time
- Been thanked: 26 times
- Contact:
- 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
Hello Wolfgang,
Sorry for missing this - I'll try to look into it tomorrow.
Sorry for missing this - I'll try to look into it tomorrow.
- 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
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.
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.
-
- 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
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
"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
- 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
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.
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.