i, the name of the digital input, as defined in the Digital I/Os of the module.
returns the status of the digital input
void os_digout (uint16_t i, uint8_t value)
set a digital output pin high or low
Parameters
i, the name of the digital output, as defined in the Digital I/Os of the module.
value, the value to be written to the digital output (0 or 1).
uint16_t os_algin_mv (uint8_t i)
read the voltage (in milivolts) on an analog input pin
Parameters
i, the name of the analog pin, as defined in the Analog Inputs of the module.
returns the voltage in milivolts of the analog input pin
Example Code
Read analog pin ANA1 and send it on the CAN bus on datapoint "DATA2"
Switch the output OUT_HSD2 based on the datapoint "DATA3"
uint16_t variable1;
variable1 =os_algin_mv(ANA1);can_db_set_value(DATA2, variable1);//Datapoint "DATA2" must be defined in User Defined CAN Messages
variable2 =(uint8_t)can_db_get_value(DATA3);//Datapoint "DATA3" must be defined in User Defined CAN Messagesos_digout(OUT_HSD3, variable2);
Return the value of the analog input pin 0 (ANA0) and write it to a variable
variable1 =os_algin_mv(ANA0);
Return the value of digital input pin 0 (D_IN0) and write it to a variable
variable1 =os_digin(D_IN0);
Turn digital outputs on and off
// Turn on digital output 0 (OUT_HSD0)os_digout(OUT_HSD0,1);// Turn off digital output 5 (OUT_HSD5)os_digout(OUT_HSD5,0);