cancel
Showing results for 
Search instead for 
Did you mean: 

Thermal Printer

bekir
Associate
Posted on January 27, 2012 at 10:02

I use Stm32f103rb microprocessor on stm32p103 board. I want to control a thermal printer. Is there anyone who give me some example code for this situation ? Thank alot

3 REPLIES 3
emalund
Associate III
Posted on January 27, 2012 at 15:58

there is no such thing as ''code to control a thermal printer''

there may be ''code to control thermal printer xyz'' available

Erik

emalund
Associate III
Posted on January 27, 2012 at 15:58

there is no such thing as ''code to control a thermal printer''

there may be ''code to control thermal printer xyz'' available

Erik

hpipon957
Associate III
Posted on January 27, 2012 at 18:42

Hi

The thermal printer manufacturers usually give some example code.

I have used the STR91 for this and found that its HW timers were very good for the job (I suppose that this is also the case for the STM32). To perform high speed printing it is important to get the stepper motor and burning pulse timing exact and it is also necessary to have temperature dependent burning pulse width operation - best with some HW protection to stop burning the thermal heads when something goes wrong in the SW) - it is quite easy to damage them by halting a debugger (for example) when a burning pulse is in operation and doesn't get turned off correctly.

I do have a thermal printer driver available (can be used like a serial interface output with text, bitmap images and line feeds) which I could probably port to the STM32 fairly quickly (as long as the thermal image model is not greatly different). Probably 2..4 days of work to complete and fully test in case this is a serious enquiry for commerical work (send private message if it is).

In case of hobby work, I would suggest making sure that you have several printers (some of them will inevitably get damaged while experimenting and developing). Start with the thermal printer manufacturer's example (if you are lucky it will be for the STM32 but probably it will be pseudo-code which will need to be interpreted to match the hardware resources) and get the stepping functions working, then loading the dot-shift register correctly (conversion between text, images etc. will need an interpretation layer which can keep one busy for quite some time) and finally and carefully get the burning pulse timing working. Have an emergency power off switch available and if something smells hot hit it as quickly as possible since the burning heads are quite sensitive and will fail if they oveheat for too long.

For high speed printing it is necessary to add a few tricks to get the stepper motor timing and burning cycles and some other parameters finely synchronised and in some cases carefully overlapped. Some additional (dynamic) PWM control of some drive signals allows higher torque to be achieved without exceeding the motor limitations (without the torque the speed will not be adequante and smudging will occur - the manufacture's design notes may mention this but it is a useful trick in any case). Make sure that the power supplies can also deliver  adequate pulsed current for the burning and stepping (some quality reservoir capacitors are useful since the current involved can be quite high - check the data sheets) - the hardware will need a bridge circuit for the stepper driving and high current output for the burning.

Regards

Mark