![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hey guys wassup. i need with wiriting a code for comaring two 8 bit numbers in the 89s51 controller. basically there will be a value in the code already set. then through one of the port there will be a 8 bit value consitant coming for a adc. i was to compare that value to the value in the code and i want to know if it is < > or = to the value in the program. can anyone help? thx | |
| |
| | (permalink) |
| help pls | |
| |
| | (permalink) |
| Here is how you do it. Code: ; ACC Countains data from Port 1 and is compared to value 45H MOV A, P1 CJNE A,#45H,NOT_EQ ; ... .... ; A = 45H. SJMP COMPARE_END NOT_EQ: JC SMALLER ; IF A < 45H. ; ... .... ; A > 45H. SJMP COMPARE_END SMALLER: ; ... .... ; A < 45H. COMPARE_END:
__________________ "There is no way to peace, peace is the way!" | |
| |