??? 06/03/05 19:46 Read: times |
#94314 - Try these Responding to: ???'s previous message |
Ofir Epstein said:
I tried the example that you gave, but the asm51 compiler says that there are two errors: 1: 0000 74 F4 mov a,#0F4h 2: 0002 78 04 MOV R0,#004h 3: 0004 78 00 00 CJNE A,R0,NOT_EQ ^ @@@@@ illegal operand @@@@@ 4: ; ... .... ; R7 = 60H. 5: 0007 40 00 NOT_EQ: JC REQ_LOW ; IF A < R0. ^ @@@@@ symbol not defined @@@@@ 6: ; ... .... ; R7 > 60H. 7: end Hi Ofir, What are you trying to do exactly? Comparing Accumulator with a value? or Comparing Acc with a register? You cant explicitly compare Accumulator with a register. CJNE can take the following forms: CJNE A,direct,rel CJNE A,#data,rel CJNE Rn,#data,rel CJNE @Ri,#data,rel In line 2 of your above code, you are moving 04h to R0(why #004h?) If you are sure that always you will be comparing Accumulator with #04h, then use CJNE A,#04h,NOT_EQ If that is not true, if the value at R0 changes (I mean that you are going to compare the value of R0 with Accumulator), then use CJNE A,00h,NOT_EQ (Since that piece of code starts at 0000h, which is the reset vector address, and upon reset PSW will be 00h, the active bank will be bank 0. So, 00h direct address will be your current R0.) Or if you are sure about the register bank in use, substitute the address of R0 of corresponding bank in the CJNE instruction. About line 5, where is the lable REQ_LOW? If your assembler cant find any label mentioned in jumps and calls, similar error will occur. Regards, Vignesh. |
Topic | Author | Date |
compares on the 8051. | 01/01/70 00:00 | |
CJNE | 01/01/70 00:00 | |
sorry, I forgot | 01/01/70 00:00 | |
compares on the 8051 | 01/01/70 00:00 | |
Not so good... | 01/01/70 00:00 | |
Comparing | 01/01/70 00:00 | |
where is the bible? | 01/01/70 00:00 | |
Here it is | 01/01/70 00:00 | |
Compare value | 01/01/70 00:00 | |
the code | 01/01/70 00:00 | |
Another method | 01/01/70 00:00 | |
what? | 01/01/70 00:00 | |
No | 01/01/70 00:00 | |
There are more errors! | 01/01/70 00:00 | |
anyone?? | 01/01/70 00:00 | |
There are more errors! | 01/01/70 00:00 | |
YOU ARE GREAT!!! THANKS!!! | 01/01/70 00:00 | |
Simulator | 01/01/70 00:00 | |
search.. | 01/01/70 00:00 | |
Compare tips | 01/01/70 00:00 | |
Try these | 01/01/70 00:00 | |
sensors | 01/01/70 00:00 | |
Macros![]() | 01/01/70 00:00 |