Hi all,
Question straight up: if I have a micrologix 1400 with a value of 1234 in register N7:0, how can I convert that value to ASCII values and store it in N7:1 and N7:2? i.e. N7:1 should have the ASCII data for "12" and N7:2 should have the ASCII data for "34".
Context, and more information...
I've been left in a tight spot by being told "yes, our product can do that" until I've ordered it and found that it can't. Long story short, now I need to send a numerical value from a Micrologix 1400 to a Modbus TCP device, but the number has to be sent as ASCII characters.
From the information I've got, each modbus register holds two characters. I need to send a 4 digit number to registers 40002 and 40003.
The number I want to display is in F8:11. The first thing I'll do is move it into an N register to remove the decimal place (not required here). Let's I move it into N7:0, and it's value is 1234.
So then I have to convert this value into ASCII characters and store it in, say N7:1 and N7:2.
Once I've done that, from my reading of the ML1400 reference manual, I just have to set up a MSG instruction to do a Modbus write to register 40002 from N7:1 with a length of 2. I've not set up a MSG instruction for Modbus TCP before, so any tips or gotchas with regard to this part of the project would be appreciated as well
Anyhow, appreciate any tips or tricks, especially with getting the data into the right format!
Question straight up: if I have a micrologix 1400 with a value of 1234 in register N7:0, how can I convert that value to ASCII values and store it in N7:1 and N7:2? i.e. N7:1 should have the ASCII data for "12" and N7:2 should have the ASCII data for "34".
Context, and more information...
I've been left in a tight spot by being told "yes, our product can do that" until I've ordered it and found that it can't. Long story short, now I need to send a numerical value from a Micrologix 1400 to a Modbus TCP device, but the number has to be sent as ASCII characters.
From the information I've got, each modbus register holds two characters. I need to send a 4 digit number to registers 40002 and 40003.
The number I want to display is in F8:11. The first thing I'll do is move it into an N register to remove the decimal place (not required here). Let's I move it into N7:0, and it's value is 1234.
So then I have to convert this value into ASCII characters and store it in, say N7:1 and N7:2.
Once I've done that, from my reading of the ML1400 reference manual, I just have to set up a MSG instruction to do a Modbus write to register 40002 from N7:1 with a length of 2. I've not set up a MSG instruction for Modbus TCP before, so any tips or gotchas with regard to this part of the project would be appreciated as well
Anyhow, appreciate any tips or tricks, especially with getting the data into the right format!