Using Hserout on 20x2 to send text and variable

sodeaf

Senior Member
Hey Guys, I have been trying to figure this out for 2 hours and come up with nothing. So I have to call on the experts,... I know I will kick myself when I see the proper solution for its probably extremely easy or close to what I have tried already without success. My Project consists of 2 Picaxe chips 28x2 which is the master sending data to 20x2 via the Serout/Serin Command then the 20X2 will send that data via HSEROUT to a Thermal Printer. I have the thermal printer working great if I send the following sting

hserout 0, ("03/14/2015|17:38|TICKET#9610|VALID FOR 60 DAYS|")

The data I am receiving from the 28X2 Master is the current Date/Time, I am receiving that data Via the Serin Command into Variables B1-B8

serin C.5,N2400,B1,B2,B3,B4,B5,B6,B7,B8
MM,DD,YY,YY,HH,MM,SS b8 is a generic command

Now I am trying to send those variables directly to printer (Not using B7(Seconds) or Generic Variable)

hserout 0, ({#}}B1,"/"{#}B2,"/"{#}B3,{#}B4,"|"{#}B5,":",{#}B6,"|TICKET#9610|VALID FOR 60 DAYS|")

But it doesn't work, and of course I have tried several variations of this with no luck

IN PE it gives me this highlighted help box with shows this

HSEROUT break, ({#}variable,{#}variable,........) So i tried to use this without any luck..

Can someone please help me..

Thanks In advance

Steve
 

srnet

Senior Member
It would be helpful if you published the code you are actually using, on all the PICAXEs.

And explain what you mean by "But it doesn't work", what actually happens ?
 

sodeaf

Senior Member
Hey there,

It doesn't work because I get an error when I hit the "Check" Button, and it indicates the error is right at the first "#" in the code line

Thanks
 

Buzby

Senior Member
Is your line exactly as you've posted it ?

ie : hserout 0, ({#}}B1,"/"{#}B2,"/"{#}B3,{#}B4,"|"{#}B5,":",{#}B6,"|TICKET#9610|VALI D FOR 60 DAYS|")

or more like it it should be ,

hserout 0, (#B1,"/",#B2,"/",#B3,#B4,"|",#B5,":",#B6,"|TICKET#9610|VALI D FOR 60 DAYS|")
 

sodeaf

Senior Member
Hey there,

Thanks for the help, I tired yours and it worked, I could swear I tried that exact thing but still got errors, but with yours it worked out.. Thanks again.. something so simple.
 

srnet

Senior Member
So do you mean you get a 'Syntax Check Failed' message ?

If so then its likely because the curly brackets in the manual indicate an optional item, you dont actually enter the curly brackets themselves.

So you would actually enter in PE;

hserout 0, (#B1,"/",#B2 etc.
 
Top