Good day,
I have an interesting question. Is it possible to map the I/O from s7 driver to a Phidget I/O(instead of step7 to machine sim) . It would be nice that way I can test my project on a cheap interface, then once project is tested, I can buy cpu and IO modules.
Yes, of course, you can use two drivers (or more) in your EasyPLC Proyects, one the S7 driver and other the Phidgets or USB OPTO RLY, or whatever...
Then only in your EasyPLC logic program have to copy the I/O signals from S7 driver to the other something like this:
for(int f= 0; f<16;f++)
{
//Write S7 Inputs with USB Card Inputs
WriteOutput(0, f, ReadInput(1, f));
//Write USB Card Outputs with S7 Outputs
WriteOutput(1, f, ReadInput(0, f));
}
The driver #0 will be the S7 and the driver number #1 the USB card
Thanks for your reply, actually I was browsing on the website and looking at the drivers I saw Arduino as a new driver as I have a few of them laying around I will test with an arduino first. Just when I thought EasyPLC couldn't get any better. Great to see that drivers and all the software always gets updates.
Actually I try to do it with arduino but based on my step7 project I have 16 I/O. I kept getting an out of bounds array index error I'm assuming because I only have 6 6 6 on arduino. So I tried to map manually by assigning my IO from both plcsim and arduino to variables tags, but it wouldn't work. Could you explain if is easier to do the mapping individually. Example if I 0.0(plcsim) then Q 0.0(arduino) I did it in ladder.
I think is better if you can attach your logic program. I can revise it and tell you what's wrong.
I have attached my program, I was trying to send / receive data between plcsim and arduino. I wanted to map I/O in ladder basically one by one. I kept getting the out of bounds index array error with the for loop. Thanks for your assistance.
[attachment deleted by admin]
The problem you have is the different number of I/O in the PLCSIM and Arduino drivers.
You have configured arduino as 6 DI / 6 DO, then you only can assing 6 I/O from 0 to 5, Also the driver numbers are 0 and 2, then your code could be similar to this example:
for (int i = 0; i < 6; i++)
{
//Write S7 inputs with Arduino input states
WriteOutput (0, i, ReadInput (2,i));
//Write Arduino Outputs with S7 Outputs
WriteOutput (2, i, ReadInput (0,i));
}