Skip to main content

Application Note: How to Get Printer's Status to Allen-Bradley's PLC?

You can read this post on LinkedIn as well.

Disclaimer: This article isn't sponsored by RealTime Automation, Zebra, or Rockwell Automation. This is an independent application note. Plus, there is no commission from links below.

Introduction:

Zebra printer seems to be quite popular in the industry. The Japanese grocery store Maruichi, the Vietnamese restaurant Pho Minh Ky, my ex (employer, not girlfriend), etc.

However, it can be painful if you need to integrate a printer with an Allen-Bradley CompactLogix controller. If your printer only has light indicators but not an integrated display like ZD420/421, you'll have to look up the troubleshooting guide to figure out the meaning. (And yes, we don't like looking it up online if there is already an HMI around.)

If you dig around on the Internet, you'll probably see an article on PLC.net that talks about opening sockets for communication. However, that can be tricky and time-consuming if you don't have sufficient IT knowledge. Not to mention maintaining the system later. If the original engineer who brought up the system leaves the job, it can be a nightmare to maintain the system.

Section 1: Network Translator

Luckily, I came across a translator 490NBX designed by RealTime Automation. You can find their support documents and sample PLC program at SUPPORT FOR 435NBX / 490NBX GATEWAYS. The documents I use are (1) Accessing the Browser-Based Configuration Guide, (2) 490NBX – Quick Start Guide, (3) 435NBX/490NBX Basic Ladder Logic Setup, and (4) ZPL II, ZBI 2, Set-Get-Do, Mirror, WML Programming Guide.

Lately, RealTime Automation put together a new document 490NBX-NNA1 ASCII to PLC Gateway Product User Guide. You may use it as the primary reference because it even covers some troubleshooting information.

With document (1), you should be able to power up your 490NBX and configure it as your design. It's straightforward to follow through the guide. However, before you move on to document (2), you need to set up the IP address of your ASCII device—Zebra printer in this case. (Honestly, other printers following the same communication protocol should work as well.)

Section 2: Configuring the Printer

Install Zebra Printer Setup Utilities and follow the instruction videos at Zebra Printer Setup Utilities Downloads & Support to configure network and printer settings.

Section 3: Setting up Communication

We can move on to document (2) 490NBX – Quick Start Guide. One critical step is Setting up TCP/IP Configuration. You will need to enter the IP address of your printer configured earlier into the IP Address of Port 0. From the screenshot below, you know you can open up to 10 ports per translator!

No alt text provided for this image

The TCP Port number can be confusing but it's simply 6101 in our example. It's provided in Default Port Number for Zebra Mobile Printers is 6101 though this isn't a mobile printer. And of course, you should reference the corresponding specification documents if you're not using Zebra printers.

If not for a special need, you can leave Inactivity Timeout and Reconnect Delay as they are. (The figure cropped from document (2) below is for reference only. You should configure IP Address and TCP Port number based on your application.)

Up to this point, you have a Zebra printer IP address, a CompactLogix IP address, and a 490NBX IP address. Remember, they should be unique!

Here comes the tricky part. You'll need to fill out a set of start delimiter and end/termination delimiter. You should be able to find these delimiters through Zebra Printer Setup Utilities or the ZebraNet Print Server Web Page if your printer is online. You can change them as you wish but remember to update accordingly on your 490NBX's configurations.

One side note is that different printer manufacturers use different programming languages. Though they may claim it's compatible, you don't know how well it is since it's often encapsulated. For example, Zebra uses ZPL and ZPL II. The funny thing is that they aren't fully compatible even with themselves! (Wait, that sounds familiar!) Another brand like SATO, their CT4-LX Series support SBPL, SEPL, SZPL, SDPL, SIPL, or STCL. It's your job to figure out what brand and model to use.

No alt text provided for this image

Section 4: Setting up PLC Tags

The next step is setting up communication from your CompactLogix to your Zebra printer. I won't elaborate on this topic here because (2) 490NBX – Quick Start Guide is quite clear in explanation. However, if you still have questions, feel free to comment below.

Now we can move on to document (3) 435NBX/490NBX Basic Ladder Logic Setup. This setup guide walks you through setting up PLC tags which are configured in the previous step in your controller. In the screenshot above, it's A2PLC_port0. In document (3), they're RTA_read (printer to controller) and RTA_write (controller to printer).

Because the LogixDesigner program example can be downloaded at SUPPORT FOR 435NBX / 490NBX GATEWAYS, I'll leave you some space for exploration. So we can move forward to the Getting Printer Status part!

Section 5: Getting Printer Status

ALL RIGHT! Now move on to the last document! Document (4) ZPL II, ZBI 2, Set-Get-Do, Mirror, WML Programming Guide. If you check out the page about ZPL command ~HQ, you can see a series of commands that you can send to your printer through the PLC tag RTA_write in the previous step. And follow the logic, the printer will respond to the command and the translator will copy the message to the PLC tag RTA_read.

No alt text provided for this image

If you send out ~HQES (HQ = Host Query), you will receive one of the responses listed in the following two tables. It may seem intimidating that there are so many flags. However, about 50% applies to KR403 printers only and I've highlighted the more common ones for you! Isn't it one less thing to worry about?

By the way, eight bits is a byte. Guess what represents four bits? It's a nibble!

No alt text provided for this image
No alt text provided for this image

For a smart reader like you, you may notice that the Ribbon Out Error Flag is the same as the Clean Printhead Warning Flag! Rest assured, my friend! Have a seat and check out the example below.

No alt text provided for this image

As you can see, the response from the Zebra printer separates the Error Flag and Warning Flag so that there is no worry about interpretation.

Section 6: Handling Printer Responses

One thing to keep in mind is that the response uses carriage returns <CR>. You have to put that into consideration when translating it into a message on HMI! You can reference my previous publication Application Note: 5069-SERIAL Communication through Generic ASCII and RS-485 for reference.

Section 7: Addition Resources

If you happen to use Maple Systems' HMI, you can refer to my two other articles How to Handle Unicode-formatted ASCII Object in EasyBuilder Pro (EBPro)? and GetData()/SetData() and Error C45 in EasyBuilder Pro (EBPro).

Conclusion:

Up to this point, I believe you can implement a display of the printer status on your HMI. Thank you for reading my application note!

Comments

Popular posts from this blog

[申辦綠卡] EB-2 NIW 國家利益豁免綠卡申請教學(一)找合作的律師事務所

Image by  David Peterson  from  Pixabay

[申辦綠卡] EB-2 NIW 國家利益豁免綠卡申請教學(零)名詞解釋 Petitioner vs Applicant

Image by  David Peterson  from  Pixabay

[申辦綠卡] EB-2 NIW 國家利益豁免綠卡申請教學(七)組裝 NIW I-140 申請文件包

Image by  David Peterson  from  Pixabay