oha,
1 ms for Data transfer is way too much. And recieving data (no sending!) in the background seems the only thing to do
'************************************************* *******************************************
' 16F628A 10 Mhz crystal 15pf capacitors
' 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 10
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
INTCON.1 = 0 ; Clear External Interrupt Flag
INTCON.4 = 1 ; Enable External Interrupt
main:
Portb.7 = 0
serin2 portB.0,16468, [inputData] 'for the future to load a value
pulseWidthVar = inputData
goto main
disable
ISR:
portb.7 = 1 'blink LED 0.02 sec one time when RB.0 goes high
pauseus 500
portb.7 = 0
INTCON.1 = 0 ; Clear External Interrupt Flag
RESUME 'resume main program
Enable 'Enable interrupts
END ' End of program
In my picbasic pro book from Dogan Ibrahim it says " USART is very complicated"
and that did not encourage me.
Because I use only 16F628A , maybe with 10Mhz that should do.
How could I use the Usart . I think those 16F628A have one....
Bookmarks