hi , im very new to assembly langauge and im doing a unit at college on it. my assignment is to write a program that would simulate a pelican crosing. ive had a good go at writting it but when i load it into the assembler it comes up with erros.
th sequence should go
TURN ON GREEN LED
DELAY
TURN ON AMBER LED ON
SMALL DELAY
TURN RED LED ON AND SOUND A BUZER
DELAY
FLASH AMBER LED ON AND OF
ive had a go at the program up to the buzer but im a bit confused to whi it isent workong.
p3 is port 3 of the robot is a bank of leds and port 2.7 is the buzzer.
if you need any more information then just say.
many thanks laura
th sequence should go
TURN ON GREEN LED
DELAY
TURN ON AMBER LED ON
SMALL DELAY
TURN RED LED ON AND SOUND A BUZER
DELAY
FLASH AMBER LED ON AND OF
ive had a go at the program up to the buzer but im a bit confused to whi it isent workong.
p3 is port 3 of the robot is a bank of leds and port 2.7 is the buzzer.
if you need any more information then just say.
many thanks laura
Rich (BB code):
main1()
{
#pragma asm
start:
mov P3, #0Dfh ;// turn on green led//
mov r7, #0ffh ;// move ffh to reg 7 ( DELAY)//
outerloop1:
mov r6, #0ffh ;// move ffh to reg 6 (DELAY)//
innerloop1:
mov r5, #0ffh
inner:
djnz r5 inner
djnz r6 innerloop1
djnz r7 outerloop1
mov P3, #0bfh ;// turn amber led on //
mov r7, #3fh ;// move ffh to reg 7//
outerloop2:
mov r6, #0ffh ;// move ffh to reg 6//
innerloop2:
mov r5, #0ffh
inner2:
djnz r5 inner2
djnz r6 innerloop2
djnz r7 outerloop2
mov P3, #7fh ;// turn red led on //
buzzer:
mov P2, #80h ;// siren on //
ACALL, delay: ;// (delay)//
mov P2, #00h ;// siren off//
ACALL, delay: ;// (delay)//
delay:
mov r2, #0fh ;// move ffh to reg 6//
innerloop8:
mov r1, #0ffh ;// move ffh to reg 5//
inner8:
djnz r1 inner8
djnz r2 innerloop8
ret
#pragma endasm
}
Last edited: