Experts! Help Me Convert decimal to ASCII string!!

Steve - It's returning an A with the first formul and a H with the second formula you gave me. 18497 is my decimal value from the PLC. The Ascii value shown within RSLogx (using the Ascii Radix) is ...OOPS!!! It worked!!! THANKYOU!
 
Thankyou Very Much Steve - That works great! - I wasted 12 hours looking at ascii tables trying to figure out how to reference the string values.
 
Keith,

Well, thankfully I did have an integer file with 41 consecutive unsued words, so I didn't need to do an upload. (What a pain in the a$$ that would have been). Worked like a charm. I had no idea about the 41 words thing, didn't see anything like that in the help files.

You get a beer! 🍺

Thanks again,
Wes

Facing same problem here.
need to convert a word stored in integer file to string file.
could you help me out
 
Hey guys, I've had some really good experiences here in the past, so I thought I'd present you with a little problem I've been having trouble solving myself.

Hardware: Allen-Bradley PLC 5/40 and Panelview 600

In concept its actually quite simple. I have a word, N42:54 that has a decimal value in it. The panelview views this word as a character array of size two and it shows up as a ASCII value. EX: N42:54 has the value "17224" which when converted to ASCII is "CH"

What I need is to somehow convert this word to ASCII and store it into a string, Call it ST15:7. I need this because I am trying to pull this value out of the datatable with OPC/DDE through MS Excel, and it pulls the value out as a decimal value instead of the ASCII. I have tried all I know, and I can't seem to get it to work.

Examples of what I have tried:
I used a TOD (to BCD) to convert N42:54 to BCD, then an AIC(Integer to ASCII string) to convert the value to a string. The BCD part worked, but the AIC just moved the result of the TOD into the string address.

I tried variations of the above, tried taking out the TOD, etc.

I am at a loss guys. Any ideas? Is it even possible?

Wes Lemstra
Convert the Decimal to Hex, then read the Hex as ASCII.


Decimal: 17224


Hex: 4348


Ascii: 43 = C 48 = H


17224 = CH
 
AIC is only supported by enhanced PLC5 processors. Is your processor enhanced?

wonder if that is the issue?


Dec Oct Hex Binary Description
067 103 43 01000011 C _._.
072 110 48 01001000 H ....

Can you just take the decimal value you have and convert it to ASC2 in your excel?

Last time I did any asc2 in plc5 it was a memory recall problem on my end. I can relate.
 
Enhanced and Ethernet PLC-5 Programmable Controllers
1785-L11B, -L20B, -L30B, -L40B, -L40L, -L60B, -L60L, -L80B, -L20E, -L40E, -L80E, -L26B, -L46B, -L86B

looked it up on enhanced pdf
Publication 1785-UM012D-EN-P - July 2005
 
It won't let me post a pic of excel spreadsheet, so formulas below:


A1: Enter Decimal Number in A1
A2: =DEC2HEX(A1)
A3: =CHAR(HEX2DEC(MID(A2,1,2)))
A4: =CHAR(HEX2DEC(MID(A2,3,2)))
A5: =CONCATENATE(A3,A4)


eg
A1: 17224
A2: 4348
A3: C
A4: H
A5: CH
 
Update: Whoops I see @Steve Bailey did this several posts ago

Try this

A2: =MOD(A1,256)
A3: =CHAR(A2)
A4: =(A1-A2)/256

A3, A4, and A5 will be the same as they are with the hex-based formulas

A3:A5 will be the same
 
Last edited:

Similar Topics

I have two different GE PLC's - a Versa Max and a 90-30 - at the same customer's site, that when power is lost or cycled off then on, the PLC's do...
Replies
4
Views
1,824
Hi, When i try to backup my existing proface touch screen, it will show error " no upload data in GP " . what is the cause ? how to solve ? Pls...
Replies
6
Views
2,631
I am a complete newbie with Omron plc’s. I have the software and leads (bought for another project but never used) but last week I was dragged...
Replies
1
Views
2,238
Dear Experts, I have five Display (PM4BC) which return ASCII string on their RS485 port (two wire), each Display can be marked up with address. I...
Replies
0
Views
2,726
I have a PLC-5 running system with one local and 3 remote chassis. There are few digital Input(1771-ICD) and Digital output(1771-OW16) modules in...
Replies
3
Views
5,495
Back
Top Bottom