Thermal Printer

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Thermal Printer

Post by electron67 »

Hello everyone,

would like to learn to printed on a thermal printer, using flowcode 6, someone to used this type of printer controlled by a PIC, I understand that works with RS232, would appreciate that could help me :!:
I know are busy launching Flowcode 7, but I hope you can help :D
PS send the datasheet of thermal printer

Thanks
Enrique
Attachments
Printer.pdf
Datasheet
(422.97 KiB) Downloaded 305 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

I'll try to point you in the right direction:

You already know the start, RS232. RS232 defines the signal levels, not the protocol (however it is a save bet it will be serial of some sort).

I suggest you read the datasheet yourself and check what the communication parameters are (speed, number of bits, stop bits etc) when you are reading, check if the printer supports a TTL level serial port as well at it is easier to connect a micro controller using TTL level. Next attempt to draw a diagram of the required connections.

As the device supports serial, you could take a look at the components to see which one supports serial communication...

If you have specific questions, feel free to ask.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

Hello Kersing,

I understand, the connection would be this way. . . .is correct ?
Attachments
Diagram
Diagram
CONEXION.JPG (9.76 KiB) Viewed 15523 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

Does the printer support TTL level serial? If it does you do not need the MAX232...
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

Hello

I made a little flowchart where it would print the number 20
Attachments
Printer.fcfx
flowchart
(4.68 KiB) Downloaded 299 times

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

Yes, support TTL, but send enyway in RS232 ?

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

The printer is connected to 12v, does not damage the PIC (I can only used RX of the printer) and would not affect the PIC the 12 v?

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

electron67 wrote:The printer is connected to 12v, does not damage the PIC (I can only used RX of the printer) and would not affect the PIC the 12 v?
Check the datasheet , what are the voltages listed for TTL interfacing?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

Keep in mind: Most printers will not print anything until a carriage return and line feed combination is received.

In flowcode you will need to use the RS232 component (a better name for it would have been serial component)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

TTL is 5v, ok, connect directly the pin TX of 16f887 at the pin 5 in the printer (pin 2 busy and pin 3 tx no connection)
Is correct ? and the flowchart printer is ok ?

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

I would connect busy to an input pin as well and check its state before sending data. Don't forget to connect ground as well.

Regarding the flowchart, check my previous message regarding CR/LF.

I think the next step is to connect the printer to a controller and run your flowchart to see what happens.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

Hello Kersing

I have the EB015, I think I can use it as an interface between the PIC and the printer? or you recommend to connect directly. . .

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

My question more than anything, is like making flowchart to pass space, print numbers or words, such as applying all these codes using the RS232 flowcode component; for example, functions to operate the printer you are on page 5:

3-2-1 Set N Dot-line Spacing
Format: ASCII: ESC 1 n
Dec: 27 49 n
Hex: 1B 31 n

Paper Feed in Line
Format: ASCII: LF
Dec: 10
Hex: 0A

3-2-5 Set Horizontal Tab Value
Format: ASCⅡ: ESC D n1 n2 n3….NUL
Dec: 27 68 n1 n2 n3….0
Hex: 1B 44 n1 n2 n3….00

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

electron67 wrote:I have the EB015, I think I can use it as an interface between the PIC and the printer? or you recommend to connect directly. . .
You can if you really want to, there is no need to. Just connect the TTL level pins directly to the controller and connect the ground of the controller to ground pin on the connector.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

electron67 wrote:My question more than anything, is like making flowchart to pass space, print numbers or words, such as applying all these codes using the RS232 flowcode component; for example, functions to operate the printer you are on page 5:

3-2-1 Set N Dot-line Spacing
Format: ASCII: ESC 1 n
Dec: 27 49 n
Hex: 1B 31 n
Think about what your problem is. You want to send specific commands to the printer for which you have the exact sequences to use.
Sending the elements of the sequence can be done with one of the macros of the RS232 components (have a look which macro accepts a byte as argument and has a name that suggests it will transmit it to a receiver.)
So to implement this you could create a macro called SetNDotlinePacing with one parameter. In the macro call the RS232 macro that transmits a byte with the value 27, call it again with 49 and next call it with the parameter. That's all there is to it,
Repeat this for the other sequences you need and you are done...
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

I want to play with this printer, buy Chinese printer, and would like to learn to use it, I have a circuit that I here call Turnero, you press a button and has a number on a display, but I want to print it a ticket:

NUMBER
        1
- - - - - - - - -

NUMBER
         2
- - - - - - - - -

NUMBER
          3

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

What is stopping you?

With the datasheet and the information in this thread you should have everything you need. Get the printer, connect it as suggested and experiment. Don't expect me to create your flowchart, I will point you in the right direction to help you but I believe you learn by trying and looking for solutions yourself. (Look in the Freelance Embedded Engineers section if you need someone to write things for you)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

Thanks Kersing,

make some tests to see if I learn to use this printer. . .

Enrique

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

Hi Kersing

the publish what I wanted to do is a basic example with what I think I could learn to use thermal printer and RFID technology with ZigBee communication and implement to make charges with electronic card and deliver printed receipt.

PS not looking for you to do anything like that, only an aid to begin to understand the programming of thermal printers, in fact much of what I learned was with examples published by Matrix of each component.

Enrique
Sorry if it not well understood my English

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

No problem. Just start by connecting the hardware and try to write some data to the printer, once that works you build on it.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

Thanks Kersing,

I hope this day have it connected to test

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

Hi Kersing

connect yesterday the printer via the RS232, I have been tested, but I can not print, see that on the table is the data for iniciallizar the printer (27, 64), also the option return (13), select character set (27 54 n), but macros RS232 I can not find how to introduce these data to the printer
Attachments
Printer
Printer
Printer.JPG (316.8 KiB) Viewed 15269 times

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

This is one of the flowcharts, pressing A0 verifies the status of the printer is free've prints a number 20
Attachments
Printer.fcfx
flowchart
(5.45 KiB) Downloaded 212 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Thermal Printer

Post by kersing »

If you insist on using RS232 levels, have you added the required connection (short block) as mentioned in the manual?

Have you considered the SendChar macro? To initialize the printer use two macro calls, one with parameter 27 and one with parameter 64.

For every line of text you want to print add SendChar(10) and SendChar(13) to let the printer know this is all data for that line. A thermal printer will not start printing before it knows the line is complete as it can not backup and add characters to the line.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Thermal Printer

Post by electron67 »

Hello Kersing, :D

After your help and many tests, work the thermal printer. . . . .enyway remove the eb015 and connect it to the TTL input, print

a simple number 20, but I started.


PS I share flowchart that worked for me to print a number. :wink:

Thanks Kersing for your time and patience.
Enrique
Attachments
Printer.fcfx
flowchart
(7.24 KiB) Downloaded 218 times

Post Reply