Hi, I need to do a function in a method but I have a “syntax error”, I’m using the “cbw32.dll” library. I’m trying make a function that write a Byte with the next code:
[code] Function write_adc_byte (CFG As Integer) As Integer
Dim Var, Data,CS, CLK,ULStat, i As Integer
CS = 1 // Bit 0 of port A
CLK = 2 //Bit 1 of port A
Data = 4 //Bit 2 of port A
DataByte = DataByte And (Not CS)
ULStat = cbDConfigPort(BoardNum, PortNum, Direction)
ULStat = cbDOut(BoardNum, PortNum, DataByte)
For i = 0 To 7
Var = CFG And Bitwise.Shiftleft(1, i)
DataByte = DataByte Or CLK
ULStat = cbDOut(BoardNum, PortNum, DataByte)
If Var <> 0 Then
DataByte = (DataByte And (Not CLK)) Or Data
Else
DataByte = (DataByte And (Not CLK)) And (Not Data)
End If
ULStat = cbDOut(BoardNum, PortNum, DataByte)
Next
DataByte = DataByte Or CS
ULStat = cbDOut(BoardNum, PortNum, DataByte)
End Function[/code]