Not Able To Control Ports

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable
        We have typed the following code to acces a port:   
   
mov a, REG[PRT2DR]   
OR A,0X0FF   
MOV REG[PRT1DR],A   
   
but the value at the port is not changing   
   
please do help ASAP   
0 Likes
1 Reply
MR_41
Employee
Employee
First like received
        When you want to control a Port pin by accessing the PRTxDR register, the pin should be set to StdCPU and the drive mode should be other than HighZ or HighZ Analog. Try setting the drive mode to StdCPU / Strong and the code should work. Also, you can directly modify the pin state by using the following instruction.   
   
or reg[PRT2DR], 0xFF   
0 Likes