Sign in to follow this  
Followers 0
Chris Elston

1734-232asc Devicenet And Slc5/03 Btye Swap Ascii

3 posts in this topic

I've never used these point I/O modules before. I've been having really good luck with inputs/ouputs and analog output modules. No issues so far. I got one of these 1734-232ASC modules. It's an RS-232 port that pops on your device net. I've had no issues getting it configured on device net, and I've mapped all the data to M-File in the processor. My question is about BTYE Swap. When I copied the data from M-Files to an ASCII file A17:0 then finally a ST18:0 file, my data looks swapped. I have a terminal window open connected to COM4, an when I type "1234", I see the data arrive when I am monitoring the 232ASC in RSNetworks as "1234", but when the data arrives in the M-FILE, it appears swapped like "2143". So what I did was enable this setting Btye-Swap in the 232ASC module, downloaded the config, and now when I send "1234" in RsNetwork is shows up as "2143", but then in the M-FILES it's a string mess, but I am able to extract the string out to ST18:1 as "1234" ASCII. It appears to work, but I was wondering if that is normal to have to do this. What exactly is "Btye-Swap" doing in this 232ASC module? There are no whitepapers in AB KB on this module and a SLC 5/03. There is a whitepaper using a CLX and RS5000. Can anyone confirm what I have found is ok, and what exactly is btye swap. Maybe I shouldn't ask why, when it seems to be working, but I like to have a better understanding of what exactly is going on. -

Share this post


Link to post
Share on other sites
This is normal. I don't have a good explaination for it so hopefully someone else will be more descriptive Your A:17 is an integer file. Your string is actually single integers. An single integer is one charactor and a integer is two charactors. When you copy from one the the other, the high byte is copied to the first single integer and the low byte is copied to the second single integer. So every two single integers are reversed. Most will have a swap byte feature just for this reason Edited by TWControls

Share this post


Link to post
Share on other sites
It's the old "big-endian" / "little-endian" confusion. Some processors arrange integers in memory with the LSB in a lower memory address than the MSB while others arrange them with LSB in a higher address than the MSB. Motorola and Intel processors are different in this regard. When copying a byte stream to 16-bit integers, one of the architectures gets the bytes backwards.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0