A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
PIC 16F747 (and PIC 16F777) - Bob Hyland, PMP - Nov 30 22:50:00 2005
I am seeing strange results using a PIC 16F747 (or a 16F777). I have
the following code segment, which I have made very simple to try to
determine why I have this issue. I have deactivated the CCP modules
(CLRF CCP1CON, CCP2CON, CCP3CON), assigned the A/D pins to I/O (CLRF
ADCON0, ADCON1, ADCON2), switched off the comparator module (CMCON =
0x07), enabled all the weak pull-ups (BCF 0x81,RBPU), and made pins
0-6 on PORTB outputs (TRISB = 0b10000000).
Now, I simply monitor pin 7, and make each other pin match the value
in polling manner. I attach 2 random PORTB pins to LED's through
(current limiting) resistors to the +5 rail.
The result? Here is what shows on my 'scope when I monitor any of
the 7 output pins and pin 7 is high:
--------_--------_--------_---------_
What gives? I am baffled. I want it to be high when pin-7 is high,
and low when pin-7 is low. What am I missing?
Any help would be greatly appreciated. Code snippet follows.
m004 BCF 0x03,RP0
BCF 0x03,RP1
BTFSS 0x06,in_7
BCF 0x06,out6
BTFSC 0x06,in_7
BSF 0x06,out6
; out5 = in_7;
BTFSS 0x06,in_7
BCF 0x06,out5
BTFSC 0x06,in_7
BSF 0x06,out5
; out4 = in_7;
BTFSS 0x06,in_7
BCF 0x06,out4
BTFSC 0x06,in_7
BSF 0x06,out4
; out3 = in_7;
BTFSS 0x06,in_7
BCF 0x06,out3
BTFSC 0x06,in_7
BSF 0x06,out3
; out2 = in_7;
BTFSS 0x06,in_7
BCF 0x06,out2
BTFSC 0x06,in_7
BSF 0x06,out2
; out1 = in_7;
BTFSS 0x06,in_7
BCF 0x06,out1
BTFSC 0x06,in_7
BSF 0x06,out1
; out0 = in_7;
BTFSS 0x06,in_7
BCF 0x06,out0
BTFSC 0x06,in_7
BSF 0x06,out0
GOTO m004 ; Never stop
Thank you,
Bob H.

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )