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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/04/03 04:53
Read: times


 
#52034 - RE: sample codes
Responding to: ???'s previous message
some sample codes on programming the I/O ports

OK students we shall use P1 for our lecture.

First example is port input, then port output :

 ( Always configure inputs as Active Low )

 InputBit :   setb  p1.0       ; make p1.0 as input
              jb  p1.0, $      ; wait here till input is active 

 InputByte:   mov p1, #0ffh    ; to make p1 as input
              mov a,  p1       ; read the 8 bits of p1 

(now Acc contains  the input data - Use it to your hearts content )

  OutputBit:  setb  p1.0       ; makes p1.0 high
              clr   p1.0       ; makes p1.0 low

  OutputByte:  mov p1, #55h    ; makes alternate bits hi/lo. 

(And I assume you have not connected any load to  these pins as of now.. ) 


Class is over for now. Such of those who want to pursue further are referred to the User Pages in the site www.8052.com. Plenty of assembly routine there.

And as per university rules code will NOT be mailed to individual mail IDs.

Raghu

List of 11 messages in thread
TopicAuthorDate
sample codes            01/01/70 00:00      
   RE: sample codes            01/01/70 00:00      
      RE: sample codes            01/01/70 00:00      
         RE: sample codes            01/01/70 00:00      
            RE: sample codes            01/01/70 00:00      
      RE: sample codes            01/01/70 00:00      
         RE: sample codes            01/01/70 00:00      
            RE: sample codes            01/01/70 00:00      
               RE: sample codes            01/01/70 00:00      
               RE: sample codes            01/01/70 00:00      
   RE: sample codes            01/01/70 00:00      

Back to Subject List