I am attempting to learn how to use serial communications
using the hardware serial port (16f627A) to receive a byte of data
but it seems to slow my program. The data looks clean (no noise).
I was expecting the hserin to quickly read the receive register.
can skip hserin and I read the rcreg directly? Do I need a interrupt?
Is there a better way?
DEFINE HSER_CLROERR 1 ' Automatically clear over-run errors
define HSER_BAUD 2400
RCIF VAR PIR1.5
command VAR
reponse VAR
loop:
if RCIF then
Hserin [command]
if command = 120 then
hserout [reponse] ' respond with data
endif
gosub refresh segment display
gosub read keypad
goto loop
or
loop:
if RCIF then
command=rcreg
if command = 120 then
hserout [reponse] ' respond with data
endif
gosub refresh segment display
gosub read keypad
goto loop
Thanks,
Mark
Bookmarks