#include #include #include "icpdas_mbs.h" #include "msw.h" int main( void ) { int RetValue,slot,channel; float tmp=0.0; float f=0.0; unsigned long l; float r; /* OPEN AO,AI,DO,DI Share Memory */ SHM_INIT(AO,2000); slot=2; channel=0; tmp=0; RetValue = Open_Slot(slot); if (RetValue >0) { printf("open Slot %d failed!\n",slot); return -1; } I8024_Initial(slot); while (1) { /* Float inverse (Big-Endian) , it depends on your SCADA */ /* *((short *)&l+1)=iMemory_AI[0]; *((short *)&l)=iMemory_AI[1]; */ /* Float (Little-Endian) */ *((short *)&l)=iMemory_AO[0]; *((short *)&l+1)=iMemory_AO[1]; f = *((float *)&l); if (tmp!=f) { printf("set value %f\n",f); I8024_VoltageOut(slot,channel,f); tmp=f; } usleep(100); } Close_Slot(slot); return 0; }