Print by PLC

atdesign

Member
Join Date
Jan 2024
Location
indiana
Posts
3
I am stuck on a project. I am still somewhat green at PLC programming and had a project given to me to get at BROTHER printer to print via plc that would print a pass label when a leak test is passed. I think I am stuck on the ascii portion. It is a serial connection rs232. Any help is appreciated
 
There are a lot of helpful individuals on this site. In order to help, we need details. To start, let us know which PLC you will be using. Secondly, if you can include what is required on the label, any pictures, prints, exact model number of the printer, etc.
 
Well, you have to read the manual of the printing language that the printer supports and send the appropriate character strings.

You will need many tests to gradually achieve the desired result.

It is recommended to use the ZPL label printing language, which is supported by many label printer brands.
 
I suggest developing in something other than the PLC to initially determine what needs to go to the printer.

For example, Python's* interactive command line (the "REPL" - Read, evaluate, print, loop), with the serial Python module, is a fairly straightforward way to send bits out the serial port. The first task would be to learn what strings have the printer printing what you want. The second task would be to hook the PLC up to the PC with Python, and have the PLC send those same strings back into the Python serial module on the PC where you can examine them easily and verify that they are the same strings that should drive the printer.

Otherwise you will be trying to get two things, it both getting the strings right and having the PLC send data through its serial port, correct at the same time, and if the printer does nothing you won't know where to look.

* an alternative to Python would be Visual Studio and the language of your choice (C#, C/C__, Visual Basic, whatever).
 
we are use a basic click plc. I also found the P-touch software for brother printers cause the label just needs the work pass and a time and date stamp. I found the language it wants to use but no matter how I put that into a send output I just can't get the printer to respond
 
Don't forget the carriage return or line feed or whatever that language asks for at the end of each line, nor the command to mark the end of the page to print it.
 
we are use a basic click plc. I also found the P-touch software for brother printers cause the label just needs the work pass and a time and date stamp. I found the language it wants to use but no matter how I put that into a send output I just can't get the printer to respond


There are many pieces to this puzzle:

  • the physical wiring pinouts of the PLC serial port and the printer serial port (RS232, RS485, A+, A-, B+, B-, Ground, Tx, Rx, DTR, CTS, CSR, DSR, ...?)
  • The serial communication settings' configuration on the PLC (Baud rate, data bits, parity bit, stop bits)
  • The serial communication settings' configuration on the printer (Baud rate, data bits, parity bit, stop bits)
  • Composing the bits and bytes sent to the printer
  • probably more that I am forgetting
In my experience, with mute* devices like printers and PLCs, it is extremely difficult to get serial communication working correctly, because if any single aspect, of the several listed above, is wrong, then it will simply not work, with no hints as to why from those mutes devices.

That is why I suggested using a non-mute* PC-based environment as an intermediate device to be able to diagnose, understand and control all of those aspects. For example, if you can successfully send characters at 9600-8N1 from a Python script on the PC to make the printer produce a label, then you know something about the printer pinouts and the printer configuration. If you can successfully receive characters at 9600-8N1 to a Python script on the PC, then you know something about the PLC pinouts and the PLC serial configuration.

If you don't know those things, then you, as well as anyone on this forum trying to help you, can only guess at what the problem is.

* a "mute" device means a device with limited human-readable diagnostic information
 
Well, you have to read the manual of the printing language that the printer supports and send the appropriate character strings.

You will need many tests to gradually achieve the desired result.

It is recommended to use the ZPL label printing language, which is supported by many label printer brands.


^Also this

If the printer support ZPL, then search this forum and the internet for examples of using ZPL with a Click PLC.
 
I am stuck on a project. I am still somewhat green at PLC programming and had a project given to me to get at BROTHER printer to print via plc that would print a pass label when a leak test is passed. I think I am stuck on the ascii portion. It is a serial connection rs232. Any help is appreciated

Hey brother, Do not bother with the brother printers,:p they are not really for the industrial environment. If it's still not bothering you then check into Zebra printer & ZPL code language. They are considered universal.
 
Hey brother, Do not bother with the brother printers,:p they are not really for the industrial environment. If it's still not bothering you then check into Zebra printer & ZPL code language. They are considered universal.

At my last job they had a lot of TSC printers in the plant, quite reliable and not as expensive as Zebra. Made in Taiwan
 
Check if your printer actually supports the programming method you are trying to use, or if it's one of the models that supports ZPL emulation:
List of Command Reference-Compatible Models and Downloads

If it supports P-Touch and/or ZPL Emulation then you need to follow this or similar:
Software Developer's Manual

Otherwise try the control codes:
Control Codes

-Check that your serial port settings are the same for both the printer and PLC (Printer manual)

-Check whether you require a null modem or straight through cable (and how many pins are required to be terminated in the cable. Some devices will work on 3 pin and some require RTS, CTS, and so on).

-Check whether what you think you are sending is what you are actually sending through your comms, and that there are no start or termination characters being added to the string by the device (Device/Port config).

-Start small. Send simple commands like clear job/queue or print test.
 

Similar Topics

Long time viewer, first time poster. First I want to start, yes I know, PLC-2 and PLC-5 do not belong in manufacturing plants anymore, but...
Replies
5
Views
2,075
Hi, I just recently had to add some safety features to an older machine. I made some changes to the PLC 2 logic for the new features. I don't...
Replies
5
Views
1,579
Hi all, Does anyone have any suitable links to products which can be used with a Siemens 1200 PLC. I am struggling to find any suitable, in an...
Replies
5
Views
2,841
I have a customer that wants to print data anytime someone presses a button for a batch addition. They want to print quantities, person's name...
Replies
8
Views
3,022
I have a ZIP file of the existing program and need to print the logic in order to reproduce the program. Any suggestions? Thanks
Replies
3
Views
1,765
Back
Top Bottom