I am working with serial communications for another project I'm working on. What happens is when I poll a device using serout and immediately use serin after that to wait for a response, the data I receive isn't correct. But if I use hserout and follow it immediately with a serin command, I get the correct data.
this example returns incorrect data:
serout b.6,t9600_8,(1,$37)
serin [10,timeout_1],b.5,t9600_8,device_data
This example returns the correct data:
hsersetup b9600_8,%001
hserout 0,(1,$37)
serin [10,timeout_1],b.5,t9600_8,device_data
Does anyone have any idea why this would happen? The only thing I am changing with these two examples is what pin I'm wired to on the picaxe and the code syntax because of hserout and serout. That's all that I see, am I missing something?
this example returns incorrect data:
serout b.6,t9600_8,(1,$37)
serin [10,timeout_1],b.5,t9600_8,device_data
This example returns the correct data:
hsersetup b9600_8,%001
hserout 0,(1,$37)
serin [10,timeout_1],b.5,t9600_8,device_data
Does anyone have any idea why this would happen? The only thing I am changing with these two examples is what pin I'm wired to on the picaxe and the code syntax because of hserout and serout. That's all that I see, am I missing something?