Wednesday, September 23, 2015

Talking to the Smart Label Pro with QBasic

So let's fire up a QBasic program to talk to the SLP Pro printer.

I open the serial port and then just do an nextbyte$=INPUT(1,#1) to fetch the next byte.

The thing about INPUT(1,#1) to get a byte is that it blocks until the next byte is received. So we need to check LOC(1) which tells you if there's bytes available if we don't really want to block.

IF LOC(1)>0 then we've got bytes, else there's no bytes yet so I'll set nextbyte="".

When I turn the printer off and then on, it sends 17 and 80. 17 is DC1 otherwise known as XON. 80 is the status byte indicating 64 (status byte base value) + 16 (STAT_IDLE).

When the printer starts printing it sends you an updated status code of 64 (STATUS_BYTE) with STAT_IDLE clear.

When it's done it will send you an 80 again (STATUS_BYTE+STAT_IDLE)

So far so good...

No comments:

Post a Comment