int aRid
int aSlot
int aIndex
int aSubi
int aDataType = 0
int aDataLen = 0
int aWhatWrite
int aNElem
stru_axio_pdi pdi
u8 aBufIn[256]
real dtRAXIO
real tActAxio
int resultAxioRObj
int resultAxioWObj
string a__srDatatype
i8 a_I8
u8 a_U8
i16 a_I16
u16 a_U16
int a_I32
u32 a_U32
i16 a_aI16[256/2]
u16 a_aU16[256/2]
int a_aI32[256/4]
u32 a_aU32[256/4]
string a_VS
u8 a_Octet[256]
struct_p MVF
float data
u8 sts
u8 unit
end_struct_p
MVF a_mvf
struct_p CNT_INC_PARAMTABLE
u16 basicConfig;
u16 Resereved1;
u16 outputConfig;
u16 outputPulseTime;
u32 startValue_convFact;
u32 lowerLimit_moduloVal;
u32 upperLimit_encIncVal;
u32 reserved2_limitValOut1;
u32 reserved3_limitValOut2;
u32 reserved4_referenceVal;
u32 reserved5_offsetZref;
u32 reserved6_trasmFact;
u32 reserved7_reserved8;
end_struct_p
CNT_INC_PARAMTABLE a_paraCntInc
function TestAXIOxOBJ()
select(opAXIOobj)
case -100
break
case 0
break
case -1
case 1
pdi.rid = aRid
pdi.slot = aSlot
pdi.index = aIndex
pdi.subindex= aSubi
pdi.dataType= aDataType
pdi.dataLen = cond_val(aDataLen = 0, sizeof(aBufIn), aDataLen)
pdi.phase = -1
tActAxio = time_micro()
resultAxioRObj = axio_robj(pdi, abufin)
dtRAXIO = time_micro() - tActAxio
if(resultAxioRObj < 0)
opAXIOobj = -100
return
endif
select(pdi.dataType)
default
a__srDatatype = "DataType : non noto"
break
case 2
a__srDatatype = "DataType : integer 8"
a_I8 = abufin[0]
break
case 5
a__srDatatype = "DataType : unsigned 8"
a_U8 = abufin[0]
break
case 3
a__srDatatype = "DataType : integer 16"
a_I16 = sw0(abufin[0])
break
case -3
a__srDatatype = "DataType : array integer 16"
move_byte(abufin, a_aI16, pdi.nric)
break
case 6
a__srDatatype = "DataType : unsigned 16"
a_U16 = w0(abufin[0])
break
case -6
a__srDatatype = "DataType : array unsigned 16"
move_byte(abufin, a_aU16, pdi.nric)
break
case 4
a__srDatatype = "DataType : integer 32"
a_I32 = sdw0(abufin[0])
break
case -4
a__srDatatype = "DataType : array integer 32"
move_byte(abufin, a_aI32, pdi.nric)
break
case 7
a__srDatatype = "DataType : unsigned 32"
a_U32 = dw0(abufin[0])
break
case -7
a__srDatatype = "DataType : array unsigned 32"
move_byte(abufin, a_aU32, pdi.nric)
break
case 9
a__srDatatype = "DataType : visible string"
move_byte(abufin, a_VS, pdi.nric)
break
case 10
a__srDatatype = "DataType : octet string"
move_byte(abufin, a_Octet, pdi.nric)
break
case -10
select(pdi.index)
default
a__srDatatype = "DataType : -Octet string - unknown structure"
move_byte(abufin, a_Octet, pdi.nric)
break
case 0x80
a__srDatatype = "DataType : -Octet string - CNT/INC param"
move_byte(abufin, a_paraCntInc, pdi.nric)
break
case 0x82
if(pdi.nRic > (int)sizeof(MVF))
a__srDatatype = "DataType : -Octet string - MVF array"
move_byte(abufin, a_aMVF[0], pdi.nric)
else
a__srDatatype = "DataType : -Octet string - MVF"
move_byte(abufin, a_MVF, pdi.nric)
endif
end_select
break
case 27
a__srDatatype = "DataType : unsigned 64 as octet"
move_byte(abufin, a_Octet, pdi.nric)
break
end_select
_if(opAXIOobj> 0)
opAXIOobj = 0;
break
case -2
case 2
pdi.rid = aRid
pdi.slot = aSlot
pdi.index = aIndex
pdi.subindex= aSubi
pdi.dataType= aDataType
pdi.dataLen = cond_val(aDataLen = 0, sizeof(aBufIn), aDataLen)
pdi.phase = 1
tActAxio = time_micro();
case -3
case 3
resultAxioRObj = axio_robj(pdi, abufin);
if(resultAxioRObj = 0)
opAXIOobj = cond_val(opAXIOobj < 0, -3, 3)
break
endif
dtRAXIO = time_micro() - tActAxio;
if(resultAxioRObj < 0)
opAXIOobj = -100;
return
endif
select(pdi.dataType)
default
a__srDatatype = "DataType : non noto"
break
case 2
a__srDatatype = "DataType : integer 8"
a_I8 = abufin[0]
break
case 5
a__srDatatype = "DataType : unsigned 8"
a_U8 = abufin[0]
break
case 3
a__srDatatype = "DataType : integer 16"
a_I16 = sw0(abufin[0])
break
case -3
a__srDatatype = "DataType : array integer 16"
move_byte(abufin, a_aI16, pdi.nric)
break
case 6
a__srDatatype = "DataType : unsigned 16"
a_U16 = w0(abufin[0])
break
case -6
a__srDatatype = "DataType : array unsigned 16"
move_byte(abufin, a_aU16, pdi.nric)
break
case 4
a__srDatatype = "DataType : integer 32"
a_I32 = sdw0(abufin[0])
break
case -4
a__srDatatype = "DataType : array integer 32"
move_byte(abufin, a_aI32, pdi.nric)
break
case 7
a__srDatatype = "DataType : unsigned 32"
a_U32 = dw0(abufin[0])
break
case -7
a__srDatatype = "DataType : array unsigned 32"
move_byte(abufin, a_aU32, pdi.nric)
break
case 9
a__srDatatype = "DataType : visible string"
move_byte(abufin, a_VS, pdi.nric)
break
case 10
a__srDatatype = "DataType : octet string"
move_byte(abufin, a_Octet, pdi.nric)
break
case -10
select(pdi.index)
default
a__srDatatype = "DataType : -Octet string - unknown structure"
move_byte(abufin, a_Octet, pdi.nric)
break
case 0x80
a__srDatatype = "DataType : -Octet string - CNT/INC param"
move_byte(abufin, a_paraCntInc, pdi.nric)
break
case 0x82
if(pdi.nRic > (int)sizeof(MVF))
a__srDatatype = "DataType : -Octet string - MVF array"
move_byte(abufin, a_aMVF[0], pdi.nric)
else
a__srDatatype = "DataType : -Octet string - MVF"
move_byte(abufin, a_MVF, pdi.nric)
endif
end_select
break
case 27
a__srDatatype = "DataType : unsigned 64 as octet"
move_byte(abufin, a_Octet, pdi.nric)
break
end_select
if(opAXIOobj> 0)
opAXIOobj = 0;
else
opAXIOobj = -2;
endif
break
case -10
case 10
pdi.rid = aRid
pdi.slot = aSlot
pdi.index = aIndex
pdi.subindex= aSubi
pdi.dataType= aDataType
pdi.phase = -1
tActAxio = time_micro();
select(aWhatWrite)
case 9
a__srDatatype = "DataType : visible string"
pdi.dataLen = str_len(a_VS) +1
resultAxioRObj = axio_wobj(pdi, a_vs);
break
case 6
a__srDatatype = "DataType : unsigned 16"
pdi.dataLen = sizeof(a_U16)
resultAxioRObj = axio_wobj(pdi, a_u16);
break
case -6
a__srDatatype = "DataType : array unsigned 16"
pdi.dataLen = sizeof(a_U16) * aNElem
resultAxioRObj = axio_wobj(pdi, a_au16);
break
case 3
a__srDatatype = "DataType : integer 16"
pdi.dataLen = sizeof(a_I16)
resultAxioRObj = axio_wobj(pdi, a_i16);
break
case -3
a__srDatatype = "DataType : array integer 16"
pdi.dataLen = sizeof(a_I16) * aNElem
resultAxioRObj = axio_wobj(pdi, a_ai16);
break
case 5
a__srDatatype = "DataType : unsigned 8"
pdi.dataLen = sizeof(a_U8)
resultAxioRObj = axio_wobj(pdi, a_u8);
break
case 2
a__srDatatype = "DataType : integer 8"
pdi.dataLen = sizeof(a_I8)
resultAxioRObj = axio_wobj(pdi, a_i8);
break
case 10
a__srDatatype = "DataType : octet string"
pdi.dataLen = aNElem
resultAxioRObj = axio_wobj(pdi, a_octet);
break
case -10
select(pdi.index)
default
a__srDatatype = "DataType : -Octet string - unknown structure"
pdi.dataLen = aNElem
resultAxioRObj = axio_wobj(pdi, a_octet);
break
case 0x80
a__srDatatype = "DataType : -Octet string - CNT/INC param"
pdi.dataLen = sizeof(a_paraCntInc)
resultAxioRObj = axio_wobj(pdi, a_paracntinc);
break
end_select
break
end_select
dtRAXIO = time_micro() - tActAxio;
if((resultAxioWObj < 0) or (resultAxioWObj > 2))
opAXIOobj = -100;
return
endif
_if (opAXIOobj> 0)
opAXIOobj = 0;
break
case -11
case 11
pdi.rid = aRid
pdi.slot = aSlot
pdi.index = aIndex
pdi.subindex = aSubi
pdi.dataType = aDataType
pdi.phase = 1
tActAxio = time_micro()
case -12
case 12
select(aWhatWrite)
case 9
a__srDatatype = "DataType : visible string"
pdi.dataLen = str_len(a_VS) +1
resultAxioRObj = axio_wobj(pdi, a_vs);
break
case 6
a__srDatatype = "DataType : unsigned 16"
pdi.dataLen = sizeof(a_U16)
resultAxioRObj = axio_wobj(pdi, a_u16);
break
case -6
a__srDatatype = "DataType : array unsigned 16"
pdi.dataLen = sizeof(a_U16) * aNElem
resultAxioRObj = axio_wobj(pdi, a_au16);
break
case 3
a__srDatatype = "DataType : integer 16"
pdi.dataLen = sizeof(a_I16)
resultAxioRObj = axio_wobj(pdi, a_i16);
break
case -3
a__srDatatype = "DataType : array integer 16"
pdi.dataLen = sizeof(a_I16) * aNElem
resultAxioRObj = axio_wobj(pdi, a_ai16);
break
case 5
a__srDatatype = "DataType : unsigned 8"
pdi.dataLen = sizeof(a_U8)
resultAxioRObj = axio_wobj(pdi, a_u8);
break
case 2
a__srDatatype = "DataType : integer 8"
pdi.dataLen = sizeof(a_I8)
resultAxioRObj = axio_wobj(pdi, a_i8);
break
case 10
a__srDatatype = "DataType : octet string"
pdi.dataLen = aNElem
resultAxioRObj = axio_wobj(pdi, a_octet);
break
case -10
select(pdi.index)
default
a__srDatatype = "DataType : -Octet string - unknown structure"
pdi.dataLen = aNElem
resultAxioRObj = axio_wobj(pdi, a_octet);
break
case 0x80
a__srDatatype = "DataType : -Octet string - CNT/INC param"
pdi.dataLen = sizeof(a_paraCntInc)
resultAxioRObj = axio_wobj(pdi, a_paracntinc);
break
end_select
break
end_select
if(resultAxioWObj = 0)
opAXIOobj = cond_val(opAXIOobj < 0, -12, 12)
break
endif
dtRAXIO = time_micro() - tActAxio;
if((resultAxioWObj < 0) or (resultAxioWObj > 2))
opAXIOobj = -100;
return
endif
if(opAXIOobj> 0)
opAXIOobj = 0;
else
opAXIOobj = -11
endif
break
end_select
endfun
|