RSLogix5000 Hex Int to ASCII

WPI-Wesley

Member
Join Date
Jul 2017
Location
Groningen
Posts
4
Hey,
i've been working on getting some add-on instructions defaulted in the company i work in. i am currently trying to create a string which shows the status of a connected module.
the status is shown in a HexInt ex.: 16#4000
in this case 16#4000 = Connected and ready.
i compare the status with that value, and if 16#4000 is true, i write "Connected" to a status string.

whenever the value is not 16#4000 i want to write that actual status into a string. as Rockwell uses these hex codes in all of their manuals, so the costumer can easily troubleshoot why the module is not communicating.

when i want to write one of these error states: ex.: 16#0000
i want the string to show 16#4000.
i tried the COP or DTOS commands.
COP comes up with a string i dont even know the size of.
DTOS shows: 4096.

how do i get the string to show the actual HexInt value of "16#0000"

in the picture you'll see a lot of double names. but that is because it is an Add-On. (instance name comes from an Add-On input. DEST EntryStatus is a local tag)


thanks :)
 
How many possible statuses are there? If it's not too many, I would just do an EQU for each one and write either the error code as a literal string, or even better the error code description. DTOS is writing the decimal value of the code and I don't believe there is any way for it to write the hex value.
 
For this particular module not too many.
But i want to make it an all-round instruction for all modules used.
The status i am using is for the connection state to a module inside the PLC network.

+ side of being able to write the codes is that Rockwell support websites and manuals reference to the Hexa codes.
 
In that case, I would write another AOI/FB that would take a decimal input and output a string with the hex equivalent, though how exactly I'm not positive though I'm sure some googling will turn up the math. I'd guess that this would be a lot easier to do in Structured Text.
 
Just use the SINT value by itself without converting it to a STRING when retrieving the modules' status.

Use the TOD (Convert to BCD) instruction when you need to 'analyze' the SINT values modules' status depending of the GSV returned hexadecimal value.
 
I have no experience with the BCD datatype, how exactly do you analize an Int with BCD?

The goal i had was to make a string for the HMI's.
when connection is OK (16#4000) it would show "Connected" as string.
if not, it shows the error code in string format.
 

Similar Topics

Hi! So my problem is a little funky, I had Studio 5000 v 24 and 30 installed, but forgot to install RSLogix (which I cannot go without). Is there...
Replies
1
Views
38
So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
419
Hello everyone, I have an RSLogix5000 project which is running live in the factory but I need to make some changes to the logic. I want to test...
Replies
0
Views
1,116
Good Morning Everyone, I'm looking to use the GSV instruction to get I/O fault codes for my project so I know if there's a comms issue in my E/IP...
Replies
5
Views
855
The machine is running production. When trying to go online with the laptop the whole machine looses communication and faults out. Drives, HMI...
Replies
13
Views
1,924
Back
Top Bottom