Reading PORTB with light pull-up resistors enabled

Thread Starter

MadMacs

Joined Dec 9, 2012
5
Hi, I need some clarity with reading PortB on say a pic 16F873. The PortB is set up with RB0-3 set as inputs and RB4-7 as outputs. PortB light pull up resistors are enabled. A command is issued: clrf PortB nop movf PortB,W. What is the value now held in W?
 

Thread Starter

MadMacs

Joined Dec 9, 2012
5
Thanks guys, so if I understand correctly, the output pins will read lo because they are cleared by the clrf PortB command - the pull-ups won't effect the result, while the other pins will read the hi of the pull-up resistors?
 

Thread Starter

MadMacs

Joined Dec 9, 2012
5
Hi guys, some more questions, if I may. I'm battling to understand the relationship between a port that has half it's pins set as output with the other half as input and the reading of the port pins. The circuit has Port B connected to a 4x3 keypad, RB0-2 for columns and RB4-7 connected to rows. Again using the example in my first question: The PortB is set up with RB0-3 set as inputs and RB4-7 as outputs. PortB light pull up resistors are enabled. A command is now issued: movlw %1110 0000 movwf PortB nop movf PortB,W. What is the value in W? Let's say that RB0 is low, i.e. a key was pressed.
 
Top