I am facing a singolar behaviour using a pic 16F628 working @ 3.3 Volts.
I am receiving a string of 9 characters via Xbee, the string is serially collected in an array using HSERIN command. The string is than decoded and an X10 command is generated via XOUT. Everything work fine only for two strings sent, with the third string the HSERIN doesn't work anymore, I need to reset the pic to get HSERIN to work again (but still for two strings only)
Using SERIN2 the problem disappear and the system works fine, but since I want to use the chip USART capability, I did try to understand the reason for such a behaviour, but with no luck.
Here the USART setting
Here the X10 command codeCode:DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 25 ' 9600 Baud @ 4MHz, 0,16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
Does anybody know if there is any incompatibility between the two commands "HSERIN and XOUT"?Code:High TxEnable ' enable pwr line transmission
pause 5
Xout X10Tx,Zcrox,[House\Unit,House\Unit2]
low TxEnable
Al.