AT89S51 Simple Project Help!!!

Thread Starter

exalive

Joined May 3, 2009
3
Hi guys,
I have wrote a program in Assembly coding.
I'm new to this so please by all means give me suggestions
( coding are in red, sorry but i find it too messy :p)

;----Coding-----
ORG 0
REC BIT P2.2 ;Assign P2.2 Receiver
SW BIT P2.1 ;Assign P2.1 to button
LED BIT P1.1 ;Assgin P1.1 to LED

Call_bus: JNB SW,Call_bus ;Jump When Switch is not press
MOV C,SW ;Sent "High" into C
MOV LED,C ; Sent "High" into LED , to turn it on
Arrive: JNB REC,Arrive ; Wait for Receiver = HIGH
Away: JB REC,Away ; Wait for Receiver = LOW
CLR C ; Clear C
MOV LED,C ; LED turn off
CLR SW ; Switch is reset
LJMP Call_bus ; Wait till button is press again
END



;--------------------

It just a simple program , but i not sure if it is correct.
But what i want the program to do is basically,

1. Button pressed LED turn on
2. Wait for Receiver to receive high signal from transmitter
3. Wait for Receiever to receiver low signal from transmitter
4. Led will turn off.
5. Wait for button to be pressed


I have loaded the program into the AT89S51 , & connected it up , but it doesn't seem to work , Anyone got any idea?
 
Top