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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/06/03 02:52
Read: times


 
#52177 - RE: sample codes
Responding to: ???'s previous message
( 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.. )
-------------------------------------------------------

how come the setting of a port as input and making a port high have the same codes? then how do I differentiate between the two?


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