Interrupt handling on 16F628A
Hi you all!
made a very small PBP programm that should work with external interrupts on RB.0.
Ha! won´t work of course otherwise I won´t post this thread.
Should send a pulse out on RB.7 (blink an LED) every time on rising edge at RB.0 , that means when a pulse gets in.
Later on when the interrupt works a byte value should be loaded serially into the pic to calculate and cause a delay before the "blink" pulse. I got the serial communication working between two PICs . The value loading doesn´t need to be in sync with the input pulse but the start of the blink hat to. Damned!
'************************************************* *******************************************
' 16F628A 4 Mhz crystal
' damn program should blink an LED every time a pulse goes into RB.0
' later a value should be serial loaded and set a delay before the blink pulse
'************************************************* *******************************************
'
' DEFINITIONS
DEFINE OSC 4
CMCON=%00000111
inputData var word ' variable to receive data into
pulseWidthVar var word
' START OF MAIN PROGRAM
'
CMCON = 7 ' RA0-RA3 are digital I/O
TRISA = 0 ' PORT A is output
TRISB = 1 ' RB0 is Input others output
on interrupt goto ISr
OPTION_REG = %01000000 'when RB.0 goes high the interrupt should work
INTCON = %10010000
main:
portb.7 = 0
serin2 portB.0,16468, [inputData] 'for the future to load a value
pulseWidthVar = inputData
goto main
disable
ISR:
pulsout portb.7, 2000 'blink LED 0.02 sec one time when RB.0 goes high
INTCON = %10010000
RESUME 'resume main program
Enable 'Enable interrupts
END ' End of program
Whats wrong with my interrupt?
Thanks in Advance. You helped me quite a lot before!