Hi mackrackit,
I've got something that 'works'
Code:
ANSEL = %00000000 'Disable analog select so ports work as digital i/o.
CMCON0 = %00000111 'Disable analog comparators.
TRISA = %00000000 'Set PORTA as OUTPUT.
PORTA = %00000000 'Set PORTA pins all low.
TRISC = %00000000 'Set PORTC as OUTPUT.
PORTC = %00000000 'Set PORTC pins all low.
DEFINE OSC 4
NUM1 VAR BYTE
NUM2 VAR BYTE
TOTAL VAR BYTE
Timeout con 10000
MAIN:
PAUSE 250
SERIN2 PORTC.5, 16780,Timeout,Data_Not_Sent,[DEC NUM1, DEC2 NUM2]
PAUSE 6000
HIGH PORTA.5
PAUSE 1000
LOW PORTA.5
LET TOTAL = NUM1 + NUM2
PAUSE 250
SEROUT2 PORTC.3, 16780, [DEC TOTAL, 10]
pause 250
DATA_Not_sent:
High PORTA.1
PAUSE 75
LOW PORTA.1
GOTO MAIN
If I just load the program into the 16F684 and leave it running, every 10 secs PORTA.1 LED blinks as per the Timeout setting. I've given it a 10 secs delay because it takes about 4 secs to input two numbers into my clunky old keyboard.
You might be wondering why there's a six second delay after the NUM's are inputted, it's so I can visually see via the LED PORTA.5 that it has arrived (if that makes sense).
What do you think.
Dave
Bookmarks