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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/08/08 06:56
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#158925 - as long as it is on one port...
Responding to: ???'s previous message
Štěpán,

Stepan Janota said:
I have two the same devices, one on pin P2.0 and another on pin P2.1. [...]I have defined bit variable " DS1820 BIT P2.2 "

It's quite unlikely you will have success with ANY of the devices, if you use a pin not connected to any of them... ;-)

However, as long as both pins are on the same port, you can pass a "parameter" in form of a mask, e.g.:
DS1820_1_MASK  EQU  01h  ;P2.0
DS1820_2_MASK  EQU  02h  ;P2.1
DS1820_3_MASK  EQU  04h  ;P2.2
[...]
   MOV   R2,#DS1820_2_MASK
   CALL  DS1820_RCV_BYTE
[...]
DS1820_RCV_BYTE:
    MOV	R5,#8
DS1820_RCV1:
    MOV A,R2   ;CLR BIT
    CPL A
    ANL P2,A
    NOP
    NOP
    CPL A      ;SET BIT
    ORL P2,A  
[...]

JW

PS. Please have a look at http://www.8052.com/faqs.phtml?FAQ=120199


List of 3 messages in thread
TopicAuthorDate
Routine parameter for port pin            01/01/70 00:00      
   write two different routines!            01/01/70 00:00      
   as long as it is on one port...            01/01/70 00:00      

Back to Subject List