-
用AI4ST做的模板,使用AI4前两个通道值,一个通道值占用一个
IW
,共占用2个word。 -
RD_ADDR
读出地址起始位
//get iw by hw_io
#tempAIw := RD_ADDR(LADDR := #AI4ST_Control.ai_hwio, PIADDR => #AI_rdaddr.piadder, PICount => #AI_rdaddr.picount, PQADDR => #AI_rdaddr.temppiadder, PQCount => #AI_rdaddr.temppicount);
PEEK
地址对应得值给出来
#AI4ST_Control.Ch0_Dig_Value := PEEK_WORD(area := 16#81, dbNumber := 0, byteOffset := #AI_rdaddr.piadder);
#AI4ST_Control.Ch1_Dig_Value := PEEK_WORD(area := 16#81, dbNumber := 0, byteOffset := (#AI_rdaddr.piadder + 2));
- 用
SCALE
把数字值变换为实际物理值
//value word to real
IF #pre_write.measure_mode = 16#01 THEN
#tempScaleWord := SCALE(IN := WORD_TO_INT(#AI4ST_Control.Ch0_Dig_Value), HI_LIM := 10.0, LO_LIM := -10.0, BIPOLAR := 1, OUT => #AI4ST_Control.Ch0_Ana_Value);
#tempScaleWord := SCALE(IN := WORD_TO_INT(#AI4ST_Control.Ch1_Dig_Value), HI_LIM := 10.0, LO_LIM := -10.0, BIPOLAR := 1, OUT => #AI4ST_Control.Ch1_Ana_Value);
ELSIF #pre_write.measure_mode = 16#02 THEN
#tempScaleWord := SCALE(IN := WORD_TO_INT(#AI4ST_Control.Ch0_Dig_Value), HI_LIM := 20.0, LO_LIM := -20.0, BIPOLAR := 1, OUT => #AI4ST_Control.Ch0_Ana_Value);
#tempScaleWord := SCALE(IN := WORD_TO_INT(#AI4ST_Control.Ch1_Dig_Value), HI_LIM := 20.0, LO_LIM := -20.0, BIPOLAR := 1, OUT => #AI4ST_Control.Ch1_Ana_Value);
END_IF;
标签:Control,rdaddr,WORD,LIM,映像,Value,硬件,AI4ST,标识符
From: https://www.cnblogs.com/xiacuncun/p/18168237