20x2 hserout

sid

Senior Member
I'm using a 20x2 and the pinout shows that pin 10 or C.0 is a dedicated hserout pin. I've read manual 2 pages 92 & 93 but I'm still obviously missing something because when I use the following code..
Code:
start:
hsersetup B1200_8, 1
b0=1
serout c.0,n1200_8, ("uuuuuuuuuu") 
pause 10					
serout c.0,n1200_8, ("ABC",b0)
pause 1000					
goto start
it appears to work in the simulator, but when I place an led across c.0 and 0v I would expect to see the led flicker on and off as the data is sent, but nothing happens, what am I missing?
 

inglewoodpete

Senior Member
I'm using a 20x2 and the pinout shows that pin 10 or C.0 is a dedicated hserout pin. I've read manual 2 pages 92 & 93 but I'm still obviously missing something because when I use the following code..
Code:
start:
hsersetup B1200_8, 1
b0=1
serout c.0,n1200_8, ("uuuuuuuuuu") 
pause 10					
serout c.0,n1200_8, ("ABC",b0)
pause 1000					
goto start
it appears to work in the simulator, but when I place an led across c.0 and 0v I would expect to see the led flicker on and off as the data is sent, but nothing happens, what am I missing?
I could be wrong but I think it's expecting an idle condition (ie not floating) on the hSerIn pin.

Edit: check matherp's post, below. I missed that clue!
 
Last edited:

sid

Senior Member
You should use hserout with hsersetup not serout. Or use serout and miss out the hsersetup
Thanks,
it doesn't work with the serout command so reading the manual (again) which states
Code:
Polarity and baud rate are defined by the hsersetup command, which must be issued before this command can be used.
I tried your idea from the first post and entered
Code:
start:
hsersetup b1200_8,1
b0=1
hserout c.0,("uuuuuuuuuuuuu")
pause 10
hserout c.0,("ABC",b0)
pause 500
goto start
but that doesn't work either.
I notice you say that perhaps it's because the hserin pin is floating and the manual does elude to the fact that the hserin and hserout commands should be used together
Code:
Information:
The hsersetup command is used to configure the fixed hardware serial port of the
microcontroller. It configures two pins to be dedicated to hserin and hserout.
Both pins are affected, you cannot use just one pin for input or output.
I don't want to receive any data, just send it, how do I stop the hserin pin from "floating"?
 

Technical

Technical Support
Staff member
Code:
hsersetup b1200_8, %10
start:
b0=1
hserout 0,("uuuuuuuuuuuuu")
pause 10
hserout 0,("ABC",b0)
pause 500
goto start
or for true data

Code:
hsersetup b1200_8, %00
start:
b0=1
hserout 0,("uuuuuuuuuuuuu")
pause 10
hserout 0,("ABC",b0)
pause 500
goto start
or using serout
Code:
start:
b0=1
serout C.0,N1200_8,("uuuuuuuuuuuuu")
pause 10
serout C.0,N1200_8,("ABC",b0)
pause 500
goto start

or using serout True data
Code:
start:
b0=1
serout C.0,T1200_8,("uuuuuuuuuuuuu")
pause 10
serout C.0,T1200_8,("ABC",b0)
pause 500
goto start
 

sid

Senior Member
Code:
hsersetup b1200_8, %10
start:
b0=1
hserout 0,("uuuuuuuuuuuuu")
pause 10
hserout 0,("ABC",b0)
pause 500
goto start
or for true data

Code:
hsersetup b1200_8, %00
start:
b0=1
hserout 0,("uuuuuuuuuuuuu")
pause 10
hserout 0,("ABC",b0)
pause 500
goto start
or using serout
Code:
start:
b0=1
serout C.0,N1200_8,("uuuuuuuuuuuuu")
pause 10
serout C.0,N1200_8,("ABC",b0)
pause 500
goto start

or using serout True data
Code:
start:
b0=1
serout C.0,T1200_8,("uuuuuuuuuuuuu")
pause 10
serout C.0,T1200_8,("ABC",b0)
pause 500
goto start
Thank you Technical,
That is now working
Rgds once again
 

sid

Senior Member
It did work but now it doesn't ooh hold now it does again.
I wanted to share my learning on this one so hopefully other people can learn from my latest mistake. I've recently started making all my circuits on pcb's using the toner transfer and etch method and great results I've been having too, so far every board has worked first time which is a far cry from the old varo board efforts which ALWAYS had some fault with them, loose solder, missing cut or cut in the wrong place etc, the joy of a pcb is a far cry from the post construction faulting of a varoboard circuit, however......
Having made a dozen or so faultless circuits one became slightly complacent and wasted everybodys time thinking he had a coding problem, when in fact what he actually had was a hair line crack in a 0.4mm wide copper track that he couldn't see until he used a magnifying glass.
So todays lessons are....
1. pcbs can go faulty too, so don't assume that it must be the code that is at fault
2.check the hardward by placing an led on the chip pin before running off to the forum
 

lbenson

Senior Member
Note that your wireless conditioning transmission is using lower case "u"s, not upper case. The purpose of using "U" is that there is variation from off to on to off in every other bit in the charactor (0101 0101), and the theory is that this helps the receiver to align itself. This is not the case with "u" (0111 0101), so whatever benefit the "U" provides is lost.
 

sid

Senior Member
Note that your wireless conditioning transmission is using lower case "u"s, not upper case. The purpose of using "U" is that there is variation from off to on to off in every other bit in the charactor (0101 0101), and the theory is that this helps the receiver to align itself. This is not the case with "u" (0111 0101), so whatever benefit the "U" provides is lost.
Reading back through my posts I havn't mentioned that I'm using a wireless link.
I am in fact using a wire connection to another 20x2 picaxe.
And I've used ("uuuuuuuuu") as a "wake up call" before sending the real data successfully many times before now.
Also as I understand it CODE IN CAPITALS IS THE same as code in lower case. I'm sure if that was incorrect the post from Technical would have said so and would have used capitals.
 

lbenson

Senior Member
This is not an important point since you are using a wired link, but while for the purpose of the program editor translating Basic code, it doesn't matter whether you use upper case or lower case, when you transmit characters, it does make a difference--sending "U" is not the same as sending "u".

Again, for your usage, it does not make a difference, tho wirelessly it might. Sorry for the diversion.
 

Technical

Technical Support
Staff member
Specific strings within speech marks "uuu" and "UUU" are different, but general command typing (HIGH 1 and high 1) are treated the same by the compiler.

So in your program "uuu" and "UUU" are different, but it just doesn't matter to you as you are not using a wireless link. The advice given is still good and was kindly given as good general advice if you had been using a wireless link, most forum posts of this nature are wireless.
 

sid

Senior Member
This is not an important point since you are using a wired link, but while for the purpose of the program editor translating Basic code, it doesn't matter whether you use upper case or lower case, when you transmit characters, it does make a difference--sending "U" is not the same as sending "u".

Again, for your usage, it does not make a difference, tho wirelessly it might. Sorry for the diversion.
Thank you IBenson,
It would seem you are right "U" is not the same as "u".
And as Technical points out, the hserout command is often used with a wireless link, all of which proves that I still have so much to learn.
 
Top