News:

  • August 23, 2026, 04:20:08 PM

Login with username, password and session length

Author Topic: BRX Hex out via RS-485  (Read 35903 times)

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: BRX Hex out via RS-485
« Reply #15 on: July 13, 2018, 01:50:20 PM »
I would do the following:
1. Power down the PLC and the Printer
2. Power up the Printer and wait for it to fully power up.
3. Power up the PLC

The printer may get confused if it receives something wrong.  The fact that you are sending something every second (not sure how fast your printer is) may be confusing it even more.  Until you get it working, don't do a STREAMOUT continuously every second - tie it to a C bit you can control from a Data View when it is appropriate (e.g. after the printer has powered up, reset, and is ready to receive commands).

Once you get it working that way, then you can tie STREAMOUT to something real (although I still would not do it every second).

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: BRX Hex out via RS-485
« Reply #16 on: July 13, 2018, 02:34:45 PM »
You may have done this but I didn't see a confirmation from you. Did you enable the termination and try swapping the RS485 leads?
An output is a PLC's way of getting its inputs to change.

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX Hex out via RS-485
« Reply #17 on: July 13, 2018, 02:46:31 PM »
I just enabled the 120Ohm termination and tried, no luck, swapped leads, no luck.

Power cycled like suggested, no luck. The printer is pretty quick but I updated the logic to have a controllable C5 bit for STREAMOUT and still no luck. I can see the TX light flash when I toggle C5.

It feels like a problem with the printing script or the PLC settings for the RS-485 port. but I also am not an expert.

The Hex code works great when I send it through the USB to Serial adapter, maybe there is a hint?

I do appreciate everyone's help thus far.

BobO mentioned that the $ in the script was an escape character, I'm not using those when sending via my laptop serial port. Maybe I need to send a literal code to the STREAMOUT?

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: BRX Hex out via RS-485
« Reply #18 on: July 13, 2018, 02:56:11 PM »
Which application are you using on the PC? Exactly how do you enter the characters? Maybe it is expecting the exact ASCII characters you wrote.
An output is a PLC's way of getting its inputs to change.

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX Hex out via RS-485
« Reply #19 on: July 13, 2018, 03:08:36 PM »
Which application are you using on the PC? Exactly how do you enter the characters? Maybe it is expecting the exact ASCII characters you wrote.

I am using the Hercules SETUP utility by HW-group.com to send it.

The printer manufacturer has specifically said that is looking for HEX

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: BRX Hex out via RS-485
« Reply #20 on: July 13, 2018, 03:11:27 PM »
BobO mentioned that the $ in the script was an escape character, I'm not using those when sending via my laptop serial port. Maybe I need to send a literal code to the STREAMOUT?

Do not confuse a PRINTER ESCAPE CHARACTER (e.g. to change color or font) with a programming languages escape character for entering non-ASCII characters e.g. STRPRINT escape character value in hex.  Code comes from source files that are in ASCII, so to represent the character A, you type "A".  To represent the character 0, you type "0".  What if you want a carriage return (CR).  How do you type that in a quoted string?
"
"
or a STX
"<IBMPCSMILEYFACE>"?

No.  Programming languages have an "escape sequence" for string literals for entering non-ASCII (or non-printable) characters.  C/C++/Java use backslash followed by 3 octal digit characters, so "\002" is STX.  It also has backslash "x" followed by 2 hex digits, so "\x02" is STX.  In Do-more (and IEC-61131) it is dollar-sign followed by 2hex-digits, so STX is "$02".  CR is "$0D".

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: BRX Hex out via RS-485
« Reply #21 on: July 13, 2018, 03:13:53 PM »
I am using the Hercules SETUP utility by HW-group.com to send it.

The software appears to be dumping raw hex.  I bet there is a radio button next to it that is ASCII (or TEXT).

I bet it's something with wiring/grounding/physical layer.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: BRX Hex out via RS-485
« Reply #22 on: July 13, 2018, 03:31:46 PM »
Serial comms and grounding can be stupid at times. That should be less an issue with RS485 than RS232, but might want to make sure the PLC and device it is talking to are on the same ground. DC powered CPUs seem particularly sensitive to this issue. Never really understood why.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX Hex out via RS-485
« Reply #23 on: July 13, 2018, 03:35:36 PM »
Serial comms and grounding can be stupid at times. That should be less an issue with RS485 than RS232, but might want to make sure the PLC and device it is talking to are on the same ground. DC powered CPUs seem particularly sensitive to this issue. Never really understood why.

I am using the Hercules SETUP utility by HW-group.com to send it.

The software appears to be dumping raw hex.  I bet there is a radio button next to it that is ASCII (or TEXT).

I bet it's something with wiring/grounding/physical layer.

I am using the Hercules SETUP utility by HW-group.com to send it.


I will add a ground wire in, right now I am using a custom made wiring setup. Photo attached. The printer has its own power supply but both it and my plc power supply are plugged into the same 120VAC circuit.
« Last Edit: July 13, 2018, 03:40:56 PM by EDurako »

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX Hex out via RS-485
« Reply #24 on: July 13, 2018, 03:50:01 PM »
Can I use the USB out on this BRX and send it through the serial converter that my laptop is using?

Below is the pin out diagram from the printer for the serial port
« Last Edit: July 13, 2018, 04:04:30 PM by EDurako »

ADC Product Engineer

  • Hero Member
  • *****
  • Posts: 270
Re: BRX Hex out via RS-485
« Reply #25 on: July 14, 2018, 09:58:07 AM »
You really need to be using twisted shielded pair cable made for RS-485.  Single wires won't cut it.  There is a very close relationship to impedance and capacitance that must be maintained in order for a communications signal to work properly.

You can't use the USB port, it is for programming only.

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX Hex out via RS-485
« Reply #26 on: July 16, 2018, 05:41:29 PM »
You really need to be using twisted shielded pair cable made for RS-485.  Single wires won't cut it.  There is a very close relationship to impedance and capacitance that must be maintained in order for a communications signal to work properly.

You can't use the USB port, it is for programming only.

Any idea where I can buy one of these twisted shielded pairs? Automation Direct?

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: BRX Hex out via RS-485
« Reply #27 on: July 16, 2018, 07:10:57 PM »
Yeah, ADC has that.  Also, you can try just twisting the wires (done it many times with a cordless).  That'll help with differential mode noise.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.