I seem to be having far too much difficulty with the use of Hserin on a 20X2. Firstly, I am unable to use the hserout as a normal i/o pin because my 6-8 month old picaxe can't handle it. That's fine, I can manage.
However, I am unable to receive any data through the Hserin pin (pin B.6). I can use this pin as a standard serial in pin, but not as a hardware serial in.
I have a feeling it is something to do with my Hsersetup command. Basically, I am using the 20X2 to 'wait' and respond to commands received via the serial in from another picaxe, sending data on N4800 baud.
Below is my code- it's a bit messy but it works if I convert the hserin commands to serin. I want the Hserin to work on N4800 baud and preferably. If I disable the Hserout pin, I get an error saying my chip doesn't support it, and even then the '%xyz' mode thing in the Hsersetup seems to be back to inverted! It's very annoying.
I have to use Hserin because the program freezes, and it needs to receive data into b0-b3 in the background
However, I am unable to receive any data through the Hserin pin (pin B.6). I can use this pin as a standard serial in pin, but not as a hardware serial in.
I have a feeling it is something to do with my Hsersetup command. Basically, I am using the 20X2 to 'wait' and respond to commands received via the serial in from another picaxe, sending data on N4800 baud.
Below is my code- it's a bit messy but it works if I convert the hserin commands to serin. I want the Hserin to work on N4800 baud and preferably. If I disable the Hserout pin, I get an error saying my chip doesn't support it, and even then the '%xyz' mode thing in the Hsersetup seems to be back to inverted! It's very annoying.
I have to use Hserin because the program freezes, and it needs to receive data into b0-b3 in the background
Code:
#picaxe 20x2
#com 3
hsersetup B2400_4,%00110
start0:
hserin b0,b1
debug
IF b0 ="1" OR b1 ="1" THEN GOTO SoundAlarmsInitiated
IF b0 ="2" OR b1 ="2" THEN GOTO SilenceInitiated
IF b0 ="3" OR b1 ="3" THEN GOTO ResetInitiated
goto start0
start1:
SoundAlarmsInitiated:
IF b0 = "2" THEN GOTO SilenceInitiated
debug
pulsout C.1,100
goto SoundAlarmsInitiated
SilenceInitiated:
debug
IF b0 = "3" THEN GOTO ResetInitiated
high C.1
IF b0 = "3" THEN GOTO ResetInitiated
pause 100
IF b0 = "3" THEN GOTO ResetInitiated
low C.1
IF b0 = "3" THEN GOTO ResetInitiated
pause 100
goto SilenceInitiated
ResetInitiated:
low C.1
goto start0
Last edited: