swapping ascii characters

rflynt

Member
Join Date
Oct 2007
Location
Rochester, NY
Posts
5
First post - I have some data in an ASCII file (A145:1). I've figured out how to move it into an ST file, but the upper and lower character are swapped. I'm working with an enhanced PLC 5/80. Can I swap those bytes as I move the data into a ST file? How is that normally handled? Thanks in advance for any help.
 
my challenge

Here is what I have in my Ascii file. 21 43 65 #7 (the # is a deliminter that designates the end of that field. The data is actually 123456. I need to get this data in the correct order, and get it into the ST data type, and finally convert it to floating point. Can anybody help?
 
rflynt said:
Can anybody help?
I haven't actually tried this so consider it just as a starting point.

given:

preswap - the 16-bit argument in which the bytes will be swapped
postswap - the result
tmp1 - a scratchpad word
tmp2 - another

PLC-5 mnemonics:
/ the following operations are performed on each word to be swapped /
DIV preswap 256 tmp1
MUL preswap 256 tmp2
OR tmp1 tmp2 postswap

The resulting values can be loaded to an ST data type by:

MOV postswap ST9:0,[data x] - where x (a literal) is the word of the string, which start from zero
 

Similar Topics

Hey guys, the scenario is: I have already completed the drawing package for my system utilizing an A-B 440R-N23126 (Minotaur) safety relay. SoS...
Replies
0
Views
173
I just finished a project that was using a CompactLogix(5069-L310ER2)and the project now requires a GuardLogix(5069-L310ERS2). I will be...
Replies
7
Views
649
I had a processor go out on a PLC rack. I am trying to use a different processor because that is what the customer had available. Original was...
Replies
1
Views
1,286
I need to swap out a compact logix 1769-OB16 does the firmware and the series have to match with the new one. Can I upgrade or downgrade the...
Replies
3
Views
1,098
Hi, Looking at installing a L8x redundancy system and have perused the manual. Yep version 1 (beta..) on L8x, probably not the best idea, as well...
Replies
2
Views
1,436
Back
Top Bottom