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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/22/11 07:40
Read: times


 
#181231 - Assembly program for blink and push button
Responding to: ???'s previous message
please try this program.
edit it according to your compiler instruction set.
logic and flow will remain same.

;**********
;* blink logic
;*********


start:

mov A, p3 ; to read value of port
ORL A, 0010 0000 B ; this to set p3.5 ( b is for binary can put this as hex )
ANL A, 0111 1111 B ; this to clear p3.7
mov P3, A ; send data to port
acall delay

mov A, p3 ; to read value of port
ORL A, 1000 0000 B ; this to set p3.7
ANL A, 1101 1111 B ; this to clear p3.5
mov P3, A ; send data to port
acall delay

ajump start

;**********************
; delay and switch logic
;***********************

delay:

mov R7, #0Fh
outloop1: mov R6, #0Fh
midloop1: mov R5, #0FFh

inloop1: mov A,P3
JB acc.2, skip ; button not pressed then jump
setb p3.6 ; button pressed
sjmp inloop1

skip: clr p3.6 ; always clear p3.6
djnz R5, inloop1
djnz R6, midloop1
djnz R7, outloop1
ret


;end program














List of 6 messages in thread
TopicAuthorDate
Help needed please for Polling a switch!            01/01/70 00:00      
   It's the #pragma asm again            01/01/70 00:00      
      why use assembler for assembler?            01/01/70 00:00      
   Other than using a Compiler            01/01/70 00:00      
   Assembly program for blink and push button            01/01/70 00:00      
      I doubt he's (still) listening            01/01/70 00:00      

Back to Subject List