Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 24th January 2005, 06:37 PM   (permalink)
Default 89s51 magnitude code

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? :idea:
thx
ohms is offline  
Old 25th January 2005, 02:59 PM   (permalink)
Default

help pls
ohms is offline  
Old 27th January 2005, 02:06 PM   (permalink)
Default

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!"
kinjalgp is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 04:43 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker