EasyManua.ls Logo

Z-World XP8600 - Page 63

Default Icon
99 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
XP8900 Software Reference s 63
XP89_1.C
#use eziocmmn.lib
/* #use ezioplc.lib // for BL1200, BL1600, PK2100, PK2200 */
/* #use eziotgpl.lib // for BL1000 */
/* #use eziolqpl.lib // for BL1100 */
/* #use eziomgpl.lib // for Bl1400 & BL1500 */
/* #use eziobl17.lib // for BL1700 */
/* #use ezioplc2.lib // for BL1700 */
main() {
auto int i;
auto struct _eioAdcCalib c;
auto int channel;
auto float f1, f2, fout;
auto long l;
auto int margin;
channel = 0; // execute watch expression
// to override
margin = 0x40; // execute watch expression
// to override
plcBusReset();
if (plcXP89Init(channel / 8)) {
printf(“DAC8 board not found\n”);
} else {
plcXP89Sw(channel / 8,1);
// enable voltage reference
plcXP89Out(channel,margin);
// use meter to record level
f1 = 10; // use watch expr to override
plcXP89Out(channel,0xfff-margin);
// use meter to record level
f2 = -10; // use watch expr to override
eioAdcMakeCoeff(&c,margin,0xfff-margin,f1,f2);
if (plcXP89WrCalib(channel,&c)) {
printf("Can’t write calibration constant\n");
}
memset(&c,0,sizeof(struct _eioAdcCalib));
if (plcXP89RdCalib(channel,&c)) {
printf("Can’t read calibration constant\n");
}
fout = 2.345; // use watch expr to override
l = eioAdcDigitize(fout, &c);
plcXP89Out(channel,(unsigned)l);
// use meter to check voltage now
}
}