Hello Guest it is March 28, 2024, 01:14:07 PM

Author Topic: Howto send DRO Axis information?  (Read 30653 times)

0 Members and 1 Guest are viewing this topic.

Howto send DRO Axis information?
« on: January 08, 2008, 06:52:50 AM »
Hi @all,

I've just startet using brains but my MPG allready works. Now I want to send the current axis position to my Modbus device but I don't know how.

My test brain uses Mach3 DRO's "842-X Position" as input, a no operation lobe and a Modbus serial plugin enables output terminator. But waht kind of data I get if I get any data?

Thanks, G.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Howto send DRO Axis information?
« Reply #1 on: January 08, 2008, 03:42:49 PM »
Here is a screen shot of what you need.
Your X Axis DRO as input, goes though a NOP, then to the Serial Plugin Modbus terminator at configuration 0, address 0 (this will send a 16 bit value out).
In the Serial modbus config set the settings for output holding register and do what ever address translation you need to to drop the value into your PLC or what ever.

scott
fun times
Re: Howto send DRO Axis information?
« Reply #2 on: January 08, 2008, 05:31:52 PM »
Hi Scot ,

i just made a test
in a 16 bit value i can send 2 caracters (ascii) but not , such as  "+123,456".
I alsofound the sendstring terminator , but there I only can send text but not a value of a dro.

Best regards
from Austria
Gerhard

Re: Howto send DRO Axis information?
« Reply #3 on: January 09, 2008, 04:37:45 AM »
Hi,

Quote
in a 16 bit value i can send 2 caracters (ascii)

This is exact the problem I have. The register contains only the places before the decimal point and it is also limited to 65535 because of the width 16bit registers.

Where is the rest?

Thanks, G.
« Last Edit: January 09, 2008, 09:23:37 AM by abacus »

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Howto send DRO Axis information?
« Reply #4 on: January 09, 2008, 08:19:59 AM »
The Brain works here, the Terminator shows the DRO value. (click view brain to watch it update).
The value transfer problem may be in how your handeling the date at the Device side.
Define what device your sending to, and data types your using (and what it supports), also if you have to use certian types i.e. holding, register, etc.
BTW: If you are sending to a PLC then remember that you are recieving a DOUBLE.

scott
fun times
Re: Howto send DRO Axis information?
« Reply #5 on: January 09, 2008, 09:19:15 AM »
Hi scott,

Quote
The value transfer problem may be in how your handeling the date at the Device side.

the transfer is device independent. In Modbus configuration dialog Cfg #0 I set Slave #: 2, Adress: 0, # of Registers: 1, Direction: Output-Holding with a refreshrate of 100ms. Mach3 sends only one 16 bit register over Modbus.

Example:

Mach3 X-Axis DRO shows +9.9750 and send "02 06 00 00 00 09 49 FF" over Modbus.

X-Axis DRO = 65535.0000 -> Modbus "02 06 00 00 FF FF 88 49"

X-Axis DRO = 65536.0000 -> Modbus "02 06 00 00 00 00 89 F9"


Thanks, G.
« Last Edit: January 09, 2008, 09:21:22 AM by abacus »

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Howto send DRO Axis information?
« Reply #6 on: January 09, 2008, 09:30:28 AM »
yes that is the modbus protocol you are seeing.

I am assuming PLC since you havent said what your sending to. ON the PLC side on your com port tick off Hex values not ascii.
In your PLC Drop the number into a register then if from that point you need to change its type do so there. I.e. Load it out, change it to Binary, real, or whatever and then send that value to the display. If you display requires Ascii you may need to change the register value trough an Ascii filter, then to your display.

If your using Peters board, then ask Peter.

scott
fun times
Re: Howto send DRO Axis information?
« Reply #7 on: January 09, 2008, 10:42:29 AM »
Hi Scott,

in your BrainControl example , mach3 sends 2 Bytes over the modbus using the modbus function 06.
This is very good to see in the examples of abacus.
In older mach3 versions , when we havn't BrainControl , I made the output with a macro in my macropump.

Example:
 '*******X-Dro Value to modbus
 Display = ""
SVal = Right(" " & Format(GetDro(0), strFmt),9)
Display = "X" & SVal
SetModIOString (1,0,0, Display)

That sends many Bytes (1Byte for 1character) to the modbus , using the modbus function 16.
When I use in BrainControl the sendstring terminator also can send text to the modbus , but I can't
find a way to send a value of a dro using the sendstring terminator.

Thanks, Gerhard





« Last Edit: January 09, 2008, 10:52:55 AM by sams_n »
Re: Howto send DRO Axis information?
« Reply #8 on: January 09, 2008, 10:45:57 AM »
I fear you do not understand what I mean.

The DROs content is a floting point value , and you need more than one 16bit register to represent this value. But Mach3 sends only one 16bit register.

Forget about HEX, ASCII, Real or Binary - this is the step that folows after Mach3 has transmit the value to the PLC. I can not handle with a value that will not completely transmited.

Thanks, G.
Re: Howto send DRO Axis information?
« Reply #9 on: January 11, 2008, 12:46:27 AM »
yes that is the modbus protocol you are seeing.

I am assuming PLC since you havent said what your sending to. ON the PLC side on your com port tick off Hex values not ascii.
In your PLC Drop the number into a register then if from that point you need to change its type do so there. I.e. Load it out, change it to Binary, real, The or whatever and then send that value to the display. If you display requires Ascii you may need to change the register value trough an Ascii filter, then to your display.

If your using Peters board, then ask Peter.

scott

Scott,


The line;
Quote
X-Axis DRO = 65535.0000 -> Modbus "02 06 00 00 FF FF 88 49"
is a dump of the Modbus data leaving the PC. The slave device has nothing to do with this yet.
The line is showing what is being sent out of the PC. It shows that the Brain is converting 65535.0000 to the integer 65536 (FFFF hex). and is writing it to address 0000. The problem is that this is not what is wanted.


The line
Quote
Mach3 X-Axis DRO shows +9.9750 and send "02 06 00 00 00 09 49 FF" over Modbus
.
Shows that reals are being converted to integers as the decimal part is being truncated.

The line,
Quote
X-Axis DRO = 65536.0000 -> Modbus "02 06 00 00 00 00 89 F9"
Shows that brains can only handle 16 bit integers as 65536 equates to 10000 hex and as such the leading 1 is lost. This is not such an issue as 16 bits is the standard integer size.


Either the brain needs to convert the value to a floating point number that the Modbus slave understands, or the brain needs to convert it to ascii characters that the slave can display. This is what the ModIO would require.

It really comes down to the functionality that Brains can provide. The macropump scripting had a function to convert a string and sent it out via Modbus. Very useful for displaying DRO etc.

I don't think that Brains has anything like this. At this stage the functionality of Brains is very primitive compared to what the MacroPump could do.

To do the ascii conversion in Brains would require a lot of runs just to conver a single DRO.


Cheers,

Peter.

Cheers,

Peter.





----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com