News:

  • August 23, 2026, 05:56:10 PM

Login with username, password and session length

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

EDurako

  • Sr. Member
  • ****
  • Posts: 52
BRX Hex out via RS-485
« on: July 10, 2018, 10:01:37 AM »
Hello,

I would like to store 2 hex strings in my BRX BX-DM1E-M-D and then based on sensor input, output the strings without converting the bits via the RS-485 port. My current Serial Port Protocol is 'Program Control' and the port type has been set to RS485. Enable 120 Ohm Termination option is false.

My strings are as follows:

02 00 08 30 3D 01 05 41 41 41 41 41 C0 03

02 00 10 30 3D 01 0C 31 32 33 47 34 35 36 37 2D 41 32 33 10 03

I have tried the following commands, COPY, MEMCOPY, Move. I am fairly sure I want to output via the IntSerial.OutQueue or STREAM.

I am having trouble getting all the targets to line up. Any help would be appreciated.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: BRX Hex out via RS-485
« Reply #1 on: July 10, 2018, 10:25:47 AM »
You can write the values to a string using STRPRINT SS0 "$02$00$08$30$3D$01$05$41$41$41$41$41$C0$03"

Send to port with STREAMOUT.

Be sure the port is set to Program Control.
"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

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: BRX Hex out via RS-485
« Reply #2 on: July 10, 2018, 11:00:27 AM »
When using STRPRINT with raw hex string literal, make sure you UNcheck the "Automatically insert space after each term" because it is checked by default  (if you actually do want a space at the end, just add a $20 to the end of your string literal!)

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: BRX Hex out via RS-485
« Reply #3 on: July 10, 2018, 11:07:48 AM »
When using STRPRINT with raw hex string literal, make sure you UNcheck the "Automatically insert space after each term" because it is checked by default  (if you actually do want a space at the end, just add a $20 to the end of your string literal!)

Oops...good catch.
"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 #4 on: July 10, 2018, 11:10:26 AM »
Thanks I really look forward to trying this out as soon as this meeting I got called into is over

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: BRX Hex out via RS-485
« Reply #5 on: July 10, 2018, 11:19:25 AM »
That looks great, but be sure to uncheck "Automatically insert space after each term". If you don't there will be a space appended to the end of SS0, which probably shouldn't be sent to your device.
"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 #6 on: July 10, 2018, 12:38:34 PM »
I have made sure the Add Space Box is UNchecked.

My printer is still not responding to the Hex string.

I ran "$02$00$08$30$3D$01$05$41$41$41$41$41$C0$03" and I also tried "02 00 08 30 3D 01 05 41 41 41 41 41 C0 03"

Both with no luck.

However, with the $ signs in the script it changes the readout so I can see what the Hex string says. I'm not sure if it is then being transferred back to Hex before going to the printer.

I don't quite understand what the $ signs are doing in this script. I am poor with script writing.
« Last Edit: July 10, 2018, 12:41:00 PM by EDurako »

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: BRX Hex out via RS-485
« Reply #7 on: July 10, 2018, 12:45:22 PM »
$ is an escape character. When you follow it with 2 hex digits, it translates into that exact value. So the character '1' has a hex value of 0x31. If you stuck $31 in the string it is the same as '1'.

Check the serial settings. Baud dates and data bits much be the same at both ends.

Make sure the port is in RS485 mode with the terminator enabled.

Check the wiring. + to + and - to - is normal, but we have seen cases where they are labeled in reverse.

Does your device need any form of command delimiter, like a carriage return / line feed?
"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

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: BRX Hex out via RS-485
« Reply #8 on: July 10, 2018, 12:51:35 PM »
And one more thing, when you enter $31, the script parser generates 0x31, and when it re-displays that, it uses the displayable character. That why it comes back with 'A' and other characters.

Another approach would be to create a BYTE buffer and then use the INIT instruction to assign individual hex values to each byte. STRPRINT produces the exact same result though.
"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 #9 on: July 13, 2018, 01:34:21 PM »
Ok, Sorry for the late response. I had some other things pop up.

When I send the following code from my laptop, the printer responds and prints as anticipated

02 00 0D 00 CA 00 00 04 00 00 00 00 42 55 4E 4E 0E 03

When I put the following script into the STRPRINT command and send via STREAMOUT, there is no response from the printer.

"02$00$0D$00$CA$00$00$04$00$00$00$42$55$4E$4E$0E$03"

I feel like its a simple fix somewhere that I'm just overlooking. Also, I will do multiple posts to convey all the screen shots.


franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: BRX Hex out via RS-485
« Reply #10 on: July 13, 2018, 01:37:13 PM »
Looks like you are missing the dollar sign from the first character in STRPRINT.  You are actually dumping two characters "02", not the STX char, which is "$02"

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX Hex out via RS-485
« Reply #11 on: July 13, 2018, 01:40:15 PM »
Looks like you are missing the dollar sign from the first character in STRPRINT.  You are actually dumping two characters "02", not the STX char, which is "$02"

Nice! I fixed that, still no response. I'm having some real trouble getting these screen shots to upload

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: BRX Hex out via RS-485
« Reply #12 on: July 13, 2018, 01:41:27 PM »
Those still don't have the $

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX Hex out via RS-485
« Reply #13 on: July 13, 2018, 01:43:30 PM »
Those still don't have the $

I picked the wrong screen grab. Can you tell I'm ready for the weekend? I get to go home if I get this printer up and going, and I mean the proverbial "I" that actually means "the nice folks in this forum"
« Last Edit: July 13, 2018, 01:47:40 PM by EDurako »

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: BRX Hex out via RS-485
« Reply #14 on: July 13, 2018, 01:45:06 PM »
updated. Any thoughts at what I'm still doing wrong?
« Last Edit: July 13, 2018, 01:50:13 PM by EDurako »