
Originally Posted by
aratti
dhoston, Xin is blocking the USART with and without the timeout
Code:
Loop:
xin X10Rx,ZCrox,[Housekey]
hSerout ["H: ",#Housekey.byte1,13,10]
hserout ["K: ",#Housekey.byte0,13,10]
goto loop
Your XIN will wait forever for an input. You can add a timeout and label to XIN but it does not solve the problem.
PBP is not a good choice for doing X10 because of this. You either need a dedicated loop that does nothing but wait for X10 input or risk missing the X10 input. Unless you can write a interrupt routine to check for input 500µS after each ZC you should look for another solution.
As it happens, I am currently working with the creater of ZBasic to refine its X10 functions. It does X10 input and output in the background automatically, including collision avoidance. The refined version should be available in a couple of weeks.
The smallest ZBasic chip costs $10 but may not have enough program memory for you. I haven't really analyzed your code.
ZBasic uses Atmel AVR chips. It has a serial bootloader and a free IDE/compiler. It has a hardware UART and up to 4 full-duplex, interrupt driven, software UARTs that operate in the background. It also has many other features but the smallest chip is 28-pins. http://www.zbasic.net/
Bookmarks