Sign in to follow this  
Followers 0
b_carlton

Modbus TCP Shift Results

2 posts in this topic

The results from a Function 03 (Read) splits the high/low byte of the returnd 16 bit words. Neither of the 4 bit shifts (SLD./SRD) seem to shift the correct direction across multiple words. Has anyone dealt with this? (CP1H with CP1W-MODTCP01-US adapter) Update - found the weird word shifting example an am implementing it. How about a REAL interface? Edited by b_carlton

Share this post


Link to post
Share on other sites
Hello b_ I'm guessing you're using ST. I use this method: ResultWord:=SHL((Reply[4] & 16#00FF),8); (* Isolate low byte, and shift up *) ResultWord:=SHR((Reply[5] & 16#FF00),8) OR ResultWord; (* Isolate high byte, shift down, and merge *) Pp

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