Serial Printer code
mbmosher
Posts: 13
Hello,
I saw a few (two) threads on using serial printers a while back, but was wondering if anyone had some stock interface code lying around.
I'm using a small thermal reciept printer made by Star, NP-211d
I have this manual: http://www.starmicronics.com/printers/printers_pages/support/manuals/NP_manuals/NP211SM.pdf
I think I could figure some of the code out from the manual, but am worried about starting up the printer right or calling specific functions, any tips anyone could give me would be great.
Thanks,
Matthew
I saw a few (two) threads on using serial printers a while back, but was wondering if anyone had some stock interface code lying around.
I'm using a small thermal reciept printer made by Star, NP-211d
I have this manual: http://www.starmicronics.com/printers/printers_pages/support/manuals/NP_manuals/NP211SM.pdf
I think I could figure some of the code out from the manual, but am worried about starting up the printer right or calling specific functions, any tips anyone could give me would be great.
Thanks,
Matthew
Comments
I've got the printer connected to my bs2 through a max232 circuit and a relay to power it on after the bs2 powers on. using the following code some interesting things happen.
OUTPUT 5
OUTPUT 14
OUTPUT 13
INPUT 15
INPUT 12
printerOn PIN 5
rx PIN 15
tx PIN 14
rts PIN 13
cts PIN 12
baudPRINT CON 240
linefeed CON $0A
htab CON $09
user VAR WORD
char VAR BYTE
PAUSE 5000
HIGH PrinterOn
DEBUG CR, CR, "printer on ", CR
PAUSE 5000
DEBUG "go "
main:
user = user + 1
SEROUT tx\cts, baudPRINT, 100, main, [noparse][[/noparse]$09, DEC user, $0A]
DEBUG DEC user, CR
char = $4D
SEROUT tx\cts, baudPRINT, 100, main, [noparse][[/noparse]char]
DEBUG char
PAUSE 100
SEROUT tx\cts, baudPRINT, 100, main, [noparse][[/noparse]$61]
DEBUG $61
PAUSE 100
SEROUT tx\cts, baudPRINT, 100, main, [noparse][[/noparse]$74]
DEBUG $74
PAUSE 100
SEROUT tx\cts, baudPRINT, 100, main, [noparse][[/noparse]"t"]
DEBUG "t"
PAUSE 100
SEROUT tx\cts, baudPRINT, 100, main, [noparse][[/noparse]$68]
DEBUG $68
PAUSE 100
SEROUT tx\cts, baudPRINT, 100, main, [noparse][[/noparse]$65]
DEBUG $65
PAUSE 100
SEROUT tx\cts, baudPRINT, 100, main, [noparse][[/noparse]"w"]
DEBUG "w"
user = user + 1
SEROUT tx\cts, baudPRINT, 100, main, [noparse][[/noparse]linefeed, htab, DEC user]
DEBUG CR, DEC user
END
so... I did this just to test my connections with the printer to see it it would do anything at all.
If i disconnect the relay get nothing after the "go " becasue the serout times out waiting for cts. If the printer is connected my debugger pane goes through the whole program but the printer doesn't do anything until it gets to the END at which point it prints X(kanji character)p and continously scrolls out paper.
Soo, I'm not really sure. I've tried taking out the pause 100 's and the user serouts. Not really sure what to do at this point. I know the printer likes hex data. Should I be SERINing something with rx\rts?
Well, thanks for any insights you may have.
Wait wait wait, I got it to work! Nevermind! Had the baud rate wrong...
Post Edited (mbmosher) : 5/9/2006 8:19:45 PM GMT