??? 01/17/12 10:31 Read: times |
#185524 - What is the octothorpe? Responding to: ???'s previous message |
Donagh Choghlan said:
Hello,
At the moment I’m trying to get a conditional statement to work in Keil. Here is my code in assembly IF A>=#0x03 SETB GAIN_ERROR RET ENDIF ;an other variation of it is IF A=#0x00 SETB GAIN_ERROR RET ENDIF It compiles without a bother but when I run the code it does not react the way I was hoping it would, does anyone have any suggestions? Donagh. I am not sure what the hash sign does in Keil. It should understand both 0x12 and 012h as expressions. As a general rule, IF will be expanded if the expression is non-zero, and not if zero. I would avoid using a single = as a comparison operator. I know that the Help Examples use it. Use EQ or ==. Note that to test for inequality you can do: IF expr - value But I find it less intuitive. You should also find you can use whitespace in parenthesised expressions. This is for your benefit. Untested. I am not a Keil expert. David. |
Topic | Author | Date |
Conditional Statements | 01/01/70 00:00 | |
Hex constants? | 01/01/70 00:00 | |
0x00, 0x01, 0x02?? | 01/01/70 00:00 | |
What is the octothorpe? | 01/01/70 00:00 | |
# | 01/01/70 00:00 | |
Immediate or not | 01/01/70 00:00 | |
what is an octothorpe? | 01/01/70 00:00 | |
Previously, on 8052.com | 01/01/70 00:00 | |
Problem solved, query still remains | 01/01/70 00:00 | |
Do some trial and error | 01/01/70 00:00 | |
Check the CJNE instruction... | 01/01/70 00:00 | |
Handy that! | 01/01/70 00:00 | |
run time vs compile time | 01/01/70 00:00 | |
IF only at assemble | 01/01/70 00:00 | |
Not Really!! | 01/01/70 00:00 | |
I second that | 01/01/70 00:00 | |
Hw variants or debugging are big users of conditionals | 01/01/70 00:00 |