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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/11/10 19:53
Read: times


 
#180080 - t89c51ac2 interrupt
Hi i am very new to assembly langauge and im studying it at tech college, ive only had 5 1 hour lessons so im just gettting my head around how every thing works. we have a robot called robo51 that uses the t89c51ac2. i have ben asked to to connect a external switch to the robot and use this to operate a interrupt. The robot has ports p3.5, p3.6 and p3.7 conected to a led and a 10k pull up resistor. what we have been told to do is to make the leds on ports 3.5 and 3.7 alterntavely flash on and off and when the button is pressed it jumps to the intterupt and led p3.6 stays on permantly then when the button is relesed the lights start to flash on and of again and the led p3.6 turns off. i do apologise if my coding is poor or amateurist but like i said i am very new to this.

from the label "Delay:" and below, i undertsand and this will make the leds flash alternatively, however, i had a go at programing the interupt part but im not sure what is going on or if i have type the right code. Any help would truely be appreciated. if you need any more information then please dont hestitat to ask.

luke


  

				mov IE, #81h				;// enbales interupts and enable external 0 interupt//

interupt:	
				ORG 0003H					;// vector address //
				
				mov P3, #0bfh				;// turn on led 3.6//
			 	
				RETI						;// return to program //


    
	
				
				
				
				ORG 0030H					;// return to main program //
				
start:				
				mov P3, #0dfh 				;// Turn on led  p3.5//
				
				acall, Delay				        ;//  delay //
				
				mov P3, #7fh 				;// turn on led p3.7 //
				
				acall, Delay				        ;//  delay //
				
				SJMP, start					;//  jump to start //
				

Delay:

	
				mov r7,#0fh 				;// 2nd register of delay //
d1:			
				

				mov r6, #0ffh				;// 1st register of dealy //
d2:	


				
				djnz r6 d2
				
				djnz r7 d1
				
				
				



						  


 


List of 6 messages in thread
TopicAuthorDate
t89c51ac2 interrupt            01/01/70 00:00      
   Classmate?            01/01/70 00:00      
      doesn't this seem peculiar?            01/01/70 00:00      
   Cristmas gift            01/01/70 00:00      
   Just for startup to 8051 mcu            01/01/70 00:00      
   Robo51; Robo-51            01/01/70 00:00      

Back to Subject List