I have used many time command Hserin, but just now I noticed that everytime the first incoming character is lost.
So a simple test code was compiled to prove this:
INCLUDE "C:\PBP\MODEDEFS.BAS"
DEFINE OSC 4
@ __config _XT_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF & _CP_OFF
intcon=%11000000 'Enable USART interrupts or else 0
t1con=0'%00110001 'Enable Timer1,prescaler/8,ON
pie1=%00100000 'Enable Peripheral Timer1,RCIE
trisa=1:trisb=1:trisc=128:trisd=0:trise=0
PORTA=0:PORTB=0:PORTC=0:PORTD=0:PORTE=0
OPTION_REG=%11110001
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h '9600 baud rate, BRGH=1
DEFINE HSER_BAUD 9600
DEFINE HSER_SPBRG 25
DEFINE HSER_CLROERR 1
adcon0=%10000001
adcon1=%10001110
i var byte
loop:
hserin [i]:hserout [i]
goto loop
end
The result is that indeed the first incoming is always lost.
Did anyone noticed that and how is it overcomed?
Ioannis
Bookmarks