okay, it's a bit confusing for myself as well.
the platform is company specific, the hardware contains a Motorola MPC5200 processor. I think it only supports basic C-functions. the program I'm programming with is called GAP Programmer but this is only used within my company.
I'll try to explain it a little better:
I have a Relay (DO) and a Discrete input (DI). The D.O. is connected to the D.I. When my program send a TRUE to the DO the relay will switch to TRUE. The program will get a feedback from the DI that the relay has actually switched.
So lets translate to my program:
DO is the output to my hardware, but this can also be an input for another function in my program. So I called it input_1.
DI is the input from the hardware that has the function to report that de relay really switched. This input I call input_2.
In my graphical programmer (internal use only) I have a block that can call a C-function. To this block I can connect multiple inputs and outputs: real, bolean or integer values.
an example code of the contents of this block:
Code:
#include wgos.h
#include math.h
FILE= file1.c
FUNCT = _FUNCT1
file1.c _FUNCT1(double Rval1, ...(num of Real Repeats),
int Ival1, ...(num of Int Repeats),
WGBOOLEAN Bval1, ...(num of Boolean repeats),
float * ROval1, ...(num of Real Out Repeats),
int * IOVal1, ...(num of Int Out Repeats),
WGBOOLEAN *BOval1, ...(num of Boolean Out repeats) )
{
//your code here
// example
if ((Rval1 > 100.0) && (Ival1 > 22) && (Bval1 == TRUE))
{
*ROval1 = 22.0;
*IOval1 = 11;
*BOval1 = FALSE;
}
else
{
*ROval1 = -22.0;
*IOval1 = -11;
*BOval1 = TRUE;
}
}
What I want to happen is that the C function measures the amount of time between the two inputs to be true. There is a delay in sending the instruction and receiving a feedback, I want to know that delay in time.
the output can just be a variable that contains a bolean or integer (1=true, 0=false) value. The C-function block can handle this and can output it to my programmer.
I hope this makes things a bit more clear!
thanks!