Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/29/10 20:49
Read: times


 
#179719 - traffic lights
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 errors.


the 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

on the label "buzzerr:" the buzer is turned on and then it jumps to the delay and then turns the buzzer off then jumps down to the delay again, i need to loop this "buzzerr:" for a delay

so what i am after is the buzer to turn on and of for a set time. Im not sure if you need this information but the controller i am using is a T89C51AC2 and it is part of a robot "robo51" and i am programing the 3 leds and the buzer



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

}
 



List of 25 messages in thread
TopicAuthorDate
traffic lights            01/01/70 00:00      
   you are thus forgiven, but            01/01/70 00:00      
   Oh, how very British            01/01/70 00:00      
      Menagerie of crossings            01/01/70 00:00      
         Animal crossings...            01/01/70 00:00      
            zebra cross            01/01/70 00:00      
               Zebra crossing project            01/01/70 00:00      
                  trafic light            01/01/70 00:00      
                     Wrong.            01/01/70 00:00      
                        Laura used MCU            01/01/70 00:00      
                           Please read posts carefully!            01/01/70 00:00      
               See the persons in that photo            01/01/70 00:00      
                  Double Pun            01/01/70 00:00      
                     Good one!            01/01/70 00:00      
   delay            01/01/70 00:00      
      Oh dear!            01/01/70 00:00      
      Sequence            01/01/70 00:00      
      Robot?            01/01/70 00:00      
   Smith & Jones?            01/01/70 00:00      
      Too many names?            01/01/70 00:00      
         there once was a TV series ... "alias Smith and Jones"            01/01/70 00:00      
            Alas, Smith & Jones            01/01/70 00:00      
            A word to brighten my day            01/01/70 00:00      
      seems like here            01/01/70 00:00      
         there's demand for that here            01/01/70 00:00      

Back to Subject List