Jump to content

Recommended Posts

Posted (edited)

Found from old PLC SHARP which the function of the circuit attached is 4 bits (M21 to M24) down counting by pulse from SM412 (1 sec clock) and this pulse can be replaced by push button. This could be useful if somebody knows how make it able to count up. Any help is appreciated. I presented using Mitsubishi Q Series. GXWorks2

BINARY COUNTER.gxw

Edited by Siscodjo
Add some notes

Posted

Not sure what is your counting is for, but in Mitsubishi PLC you have DECO function. DECO[D1 M21 K2] put it in the very beginning of your ladder.

You can set D1 to 1 to turn M21 on, 2 to turn M22 on, 4 to turn M23 on and 8 to turn M24 on. D1 is your control word, and DECO will decode it to binary starting from M21 for K2 (four bits, 2^k2) starting with lower bit (lower bit goes to M21).

So instead of counting up or down, in your step ladder you changing value of D1 as you need (you can turn your coils individually or any other pattern changing D1 from 0 to 15)

 

Hope this helps.

 

Sergey

Posted

We also use DECO for our step sequence logic. But the result is not binary, its N-th bit on. so D1 = 3, M23 would be on, not M21 & M22

If you just want to count in binary, 

SM412 INCP D0

SM400 BIN D0 D10

Posted
22 hours ago, WattUp said:

We also use DECO for our step sequence logic. But the result is not binary, its N-th bit on. so D1 = 3, M23 would be on, not M21 & M22

If you just want to count in binary, 

SM412 INCP D0

SM400 BIN D0 D10

You are correct, with K2 it converts only two low bits from D1. So D1 is in the range of 0 to 3 rest of it would be ignored. And yes only one coil in a time will be on. I missed the point of binary counting from OP program. Seems like whole intension was to build a step logic, so I thought DECO will do it just easier then all that.

  • Like 1
Posted

I don't fully understand what the OP wants with the program, nor do I really understand ladder. Especially in the lower networks, something must be wrong, or is it necessarily this way? :-)
In ST language, I would do it this way.

INCP(M0, D0); (* Up *)
DECP(M1, D0); (* Down *)
LIMIT(TRUE, 0, 15, D0, D0 );
K1M21 := D0;	(* Write binary to M21..M24 *)

The command K1M21 writes 1 nibble (4 bits) from M21 as binary value of D0.

  • Like 1
  • Solution
Posted

Hi All,

Sorry for the very late response, just came back from remote job.  

Thanks to the solutions given. I did the Sergey's advice.

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
×
×
  • Create New...