Host Engineering Forum
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 20, 2018, 09:06:37 pm


Login with username, password and session length


Pages: [1] 2
  Print  
Author Topic: BRX Hex out via RS-485  (Read 258 times)
EDurako
Jr. Member
**
Posts: 12


« on: July 10, 2018, 09: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.
Logged
BobO
Host Moderator
*****
Posts: 4131


Yes Pinky, Do-more will control the world!


« Reply #1 on: July 10, 2018, 09: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.
Logged

"We would rather apologize to 20% for what we chose not to do, than to apologize to 100% for what we did poorly." -BobO
franji1
Bit Weenie
Host Moderator
*****
Posts: 2336



WWW
« Reply #2 on: July 10, 2018, 10: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!)
Logged

BobO
Host Moderator
*****
Posts: 4131


Yes Pinky, Do-more will control the world!


« Reply #3 on: July 10, 2018, 10: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.
Logged

"We would rather apologize to 20% for what we chose not to do, than to apologize to 100% for what we did poorly." -BobO
EDurako
Jr. Member
**
Posts: 12


« Reply #4 on: July 10, 2018, 10:10:26 am »

Thanks I really look forward to trying this out as soon as this meeting I got called into is over
Logged
BobO
Host Moderator
*****
Posts: 4131


Yes Pinky, Do-more will control the world!


« Reply #5 on: July 10, 2018, 10: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.
Logged

"We would rather apologize to 20% for what we chose not to do, than to apologize to 100% for what we did poorly." -BobO
EDurako
Jr. Member
**
Posts: 12


« Reply #6 on: July 10, 2018, 11:38:34 am »

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, 11:41:00 am by EDurako » Logged
BobO
Host Moderator
*****
Posts: 4131


Yes Pinky, Do-more will control the world!


« Reply #7 on: July 10, 2018, 11:45:22 am »

$ 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?
Logged

"We would rather apologize to 20% for what we chose not to do, than to apologize to 100% for what we did poorly." -BobO
BobO
Host Moderator
*****
Posts: 4131


Yes Pinky, Do-more will control the world!


« Reply #8 on: July 10, 2018, 11:51:35 am »

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.
Logged

"We would rather apologize to 20% for what we chose not to do, than to apologize to 100% for what we did poorly." -BobO
EDurako
Jr. Member
**
Posts: 12


« Reply #9 on: July 13, 2018, 12: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.

Logged
franji1
Bit Weenie
Host Moderator
*****
Posts: 2336



WWW
« Reply #10 on: July 13, 2018, 12: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"
Logged

EDurako
Jr. Member
**
Posts: 12


« Reply #11 on: July 13, 2018, 12: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
Logged
franji1
Bit Weenie
Host Moderator
*****
Posts: 2336



WWW
« Reply #12 on: July 13, 2018, 12:41:27 pm »

Those still don't have the $
Logged

EDurako
Jr. Member
**
Posts: 12


« Reply #13 on: July 13, 2018, 12: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, 12:47:40 pm by EDurako » Logged
EDurako
Jr. Member
**
Posts: 12


« Reply #14 on: July 13, 2018, 12:45:06 pm »

updated. Any thoughts at what I'm still doing wrong?
« Last Edit: July 13, 2018, 12:50:13 pm by EDurako » Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM