[?+]: Swap bytes in a word CAW/CAD?

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Tcp
Posts: 21
Joined: Thu Jun 28, 2007 9:46 pm
Location: Australia

[?+]: Swap bytes in a word CAW/CAD?

Post by Tcp » Mon Oct 01, 2007 8:03 am

IS THERE AN EASIER WAY TO SWAP BYTES IN A WORD?

Dreamer76
Posts: 88
Joined: Sun Feb 18, 2007 10:47 am
Location: Europe

Post by Dreamer76 » Mon Oct 01, 2007 5:44 pm

can you please tell me exactly what you want to do? :?:
then i can help you maybe
ciao
Dreamer76

ian
Posts: 9
Joined: Wed Apr 18, 2007 7:00 pm
Location: Netherlands

Post by ian » Mon Oct 01, 2007 7:12 pm

in SCL

Code: Select all

INPUT     : WORD;
RESULT    : WORD;  

RESULT := ROL(IN:=INPUT, N:=8); // 8bits is 1byte

// INPUT  = 1111111100000000
// RESULT = 0000000011111111

Tcp
Posts: 21
Joined: Thu Jun 28, 2007 9:46 pm
Location: Australia

SWAP BYTES

Post by Tcp » Tue Oct 02, 2007 1:28 am

Someone elese helped me to do this.
See Help F1 for CAW (word) and CAD (dword)

L MW0
CAW
T MW1

Thanks everyone