Omron ST shift instruction

andepand

Member
Join Date
Jan 2017
Location
Amsterdam
Posts
72
Hello fellow enthousiasts,

I having a small Structured Text problem on an Omron CJ2M using CX-programmer.
I’m trying to use an SHL instruction but I can’t get it to work because I have no idea how to make it shift.

The syntax sort of looks like this: A:= SHL (B,C)

A being the outcome
B being the word I want to shift left
C being the number of bits I want to move it

But what makes the instruction shift, where do I put my clock pulse or machine cycle pulse?

I tried placing it in an IF statement:
IF P_1s THEN
A:= SHL (B,C)
END_IF

The compiler agrees with the syntax but no output whatsoever on A:=
What am I missing here?

Thanks in advance!

Greetings,
Andy
 
Last edited:
Well
It is.

And even if it wasn’t, I still don’t know what makes the bits shift.
In the ladder instruction there is an input (ST) for it.
 
I forgot to mention that it’s written inside a Function Block.
Creating a bool named trigger didn’t work. I suppose it has to be assigned to my shift instruction, and that’s my whole problem
 
P_1s is high for 0.5 sec so any bits will shift through very quickly.
I'd oneshot it.
And I would ignore osmanmon's suggestion. That won't help.
Pp
 
I figured.

For testing I leave B high (changed it to a BOOL for testing purposes), so I think it should keep outputting 1’s as long as I do that.
 
Last edited:
Maybe I’m looking at it wrong. I’m treating this instruction as a regular ladder SFT instruction and probably I shouldn’t.

Anyone out there with proper Structured text knowlege?
 

Similar Topics

(Note: also posted at MrPLC) The results from a Function 03 (Read) splits the high/low byte of the returnd 16 bit words. Neither of the 4 bit...
Replies
6
Views
3,243
Hi all. Say I'm using address W1 as my starting (and end) words in the SFT(010) instruction; does anyone know whether it's ok to "parallel load"...
Replies
4
Views
4,562
I am using WSFT command to collect different process variables. I am displaying info on NS touchscreen. Is there a better way to do this? Maybe a...
Replies
2
Views
3,440
Has anyone done SMS messaging from an Omron CJ2J-CPU31 PLC? If so could you help please. Omron here in Oz have not had any experience doing this...
Replies
5
Views
121
I have an old plc in the system I have, moxa nport was used to communicate with scada, I want to replace the plc with cj2m cpu33 and eliminate...
Replies
1
Views
63
Back
Top Bottom