Hello and good day/night (depending on what region your in).. I have a question concerning the matter above,
i would like to create a simple program that the arduino can understand that is base on PLC ladder diagram.
i am more familiar with a ladder diagram that coding but i am trying to make the transition as easy as possible, though i have bought arduino uno for the long time, i truly think that i only able to scratch on the the surface of its capability. However in ladder diagram, i have an intermediate certificate in PLC programming and i really hope that i can use the same logic and principle to make sense of arduino coding.
i know that ( sorry for using ascii art to demonstrate due to not having any plc software at home)
:
on a ladder diagram
------|I1|------ or ------|/I1|----- is an input of I1 and
on arduino coding
int I1=2;
void setup()
{
pinMode(I1,INPUT);
}
void loop(){}
on PLC
-----(Q1)------ meaning that Q1 is an output
on arduino
int Q1=3;
void setup()
{
pinMode (Q1, OUTPUT)
}
void loop(){}
on plc
I1 Q1
----||------( ) meaning that when the input I1 high Q1 is high
on arduino
int I1=2;
int Q1=3;
void setup()
{
pinMode (I1,INPUT);
pinMode (Q1,OUTPUT);
}
void loop()
{
boolean StateIn1=digitalRead(I1);
digitalWrite(Q1, StateIn1);
// or simple yet just digitalWrite (Q1,digitalRead(I1));
}
but my real question is this how can i make the coding for arduino to an equivalent of PLC keep function
like :
I1 I2 Keep1
---| |--||-----ls l
I3 l l
---||---------lr l
according to this program
a high (I1) and a low (I2) with make the output high (keep1)
however the low (I3) will make it the output low
the keep function on a PLC is identical to rs flip flop.
how can i write this ladder diagram into arduino?
please help me, any idea would be great. And i thank anyone in advance to have spend your time read my question and to help me.