| ??? 06/06/05 11:19 Read: times |
#94391 - Compare tips Responding to: ???'s previous message |
Try using '$+3' as the jump address instead of the defined label shown in the above example. This forces the PC to the next address (ie 3 bytes after the current instruction) if it passes the test - the same place it arrives at if it fails. Then test the carry state. This saves a label, and makes the instruction 'universal'.
mov a,#6
cjne a,ram_byte,$+3
jc ram_byte_gtr_than_6
.... ;ram_byte =< 6
ram_byte_gtr_than_6:
.... ;ram_byte > 6
Alternatively, compile a set of macros like this: ;** -CJL Compare and jump if X1 less than X2 CJL macro X1,X2,X3 LOCAL X0 cjne X1,X2,X0 X0: jc X3 MEND ;** -CJGE Compare and jump if X1 equal or greater then X2 CJGE macro X1,X2,X3 LOCAL X0 cjne X1,X2,X0 X0 jnc X3 MEND |
| 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 |



