I have a 16F628A as an infrared rcvr/xmtr pair and the data is transferred fine but having some intermitent problems. (It may be my receiver breadboard, if my code looks alright....it may well be the breadboard.....it works off and on).
I'll junk the breadboard if the code looks ok.
Neverthe less, I'd like to check some things and also want to make sure that the code is letting the pic sleep.
(1) If you're using the PORTB.0 interrupt, do you have to enable the PORTB pullups? If so, does it set the whole port or can you assign the pullups individually? (I'll have to use an external 10k...if I need to)
(2) When you come out of sleep and you see a high pulse on PORTB.0 and go to a routine.....at some point you need to reset the B.0 flag, right?
INTCON.1 = 0
My code for the Xmtr is basically as follows....I'm using 1n4148 steering diodes at every switch to take PORTB.0 high... (and wake up chip?).
WDT is off.
START:
SWITCH.1 = PORTA.0 '10K PULLDOWNS ON ALL
SWITCH.2 = PORTA.1
ETC
SEROUT PORTB.7,T1200,[QUAL,SWITCH]
INTCON.1 = 0
IF SWITCH = 0 THEN LOWPWR
IF SWITCH >= 1 THEN START
LOWPWR:
INTCON.4 = 1 'ENABLE INTERRUPT
OPTION_REG.6 = 1 'LOW TO HIGH TRIGGER
@SLEEP
PAUSE 100
INTCON.4 = 0 'DISABLE INTERRUPT (Ok here?)
GOTO START
END
Thanks for any help on this.
Bookmarks