Hey all - I'm moving right along figuring this stuff out thanks to all your help but I hit another unknown today.
I set a pin as an input, but when I feed it an input (say a +5v square wave pulse) it is "sinking" it. I view it with the scope and it just reads ground, but if I break the connection to the pin on the PIC, the line is showing the square wave. Touch the PIC pin again and it goes flat again on the scope.
The pin I'm using is RA1 on a 16F688. I was originally trying to use RA2, saw this problem, then saw in the data sheet in the pinout description that RA2 is listed as a schmitt trigger, and not TTL. So I tried to use RA1 instead as it is specifically listed as a TTL input.
I've also tried running a simple code to toggle a probe pin up and down and that's not working either - as if for some reason that pin just won't see my input at all.
Here is my code:
Code:
define OSC 20 'Set PBP Osc clock to 20Mhz
TRISA = 1 'All A port I/O's as inputs
ANSEL = %00000000 'Turn off analog input for ports, set digital I/O
CMCON0 = %00000111 'Turn off comparators (CMCON0.0:2 = 111)
TRISC = 0 'All C port I/O's as outputs
mysignal VAR PORTA.1 'signal on RA1
probe VAR PORTC.3 'o-scope probe RC3
LOW probe
mainloop:
if mysignal = 1 THEN
HIGH probe
ENDIF
IF mysignal = 0 THEN
LOW probe
ENDIF
GOTO mainloop
END
This same sort of example has seemed to work on other PIC's but it just won't work here. I'm confused and assuming there is some additional register I need to configure that I'm missing.
Thanks!
Bookmarks