Here is the complete code:
I have source of signal (chip with name grinded off, but holtek logo is recognizable), which is connected directly to PORTC.4. Also, scope is connected to same pin.Code:Include "modedefs.bas" ' Include serial modes TRISA = %11111111 ' Set PORTA to all input TRISC = %00000000 ' Sets all PortB pins to output ADCON1 = %10000101 ' Set PORTA analog and right justify result ADCON0=%00000000 low portc.4 low portc.5 X VAR PORTC.4 DEFINE LCD_DREG PORTB DEFINE LCD_DBIT 4 DEFINE LCD_RSREG PORTB DEFINE LCD_RSBIT 0 DEFINE LCD_EREG PORTB DEFINE LCD_EBIT 1 DEFINE LCD_BITS 4 DEFINE LCD_LINES 2 DEFINE LCD_COMMANDUS 1500 DEFINE LCD_DATAUS 44 DEFINE OSC 4 lcdout "test 2" PAUSE 500 LABEL VAR WORD DROEBITI VAR WORD taki: if portc.4=0 then COUNT PORTC.4, 60, LABEL endif if label=0 then goto taki endif LCDOUT $FE,$c0, DEC(LABEL), " " GOTO TAKI
As long as I introduce the statement "if portc.4=0 then"
If it is "=0" then pin is sunk to ground, so no pulses can be detected, and nothing can be seen on scope. If it is "=1", then pin gets driven high, and no pulses can be seen with scope or read too.
Chip is 16F870.




Bookmarks