DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware in the loop/ Script serial output

 

 

Hello,

I am working right now on a solution for my problem: I want to check sensor channel for a certain limit value WHILE measuring.  If the value measured exeeds the given limit it should send a serial output "1" to a COM port. I wanna use DAC script driver for this.

My problem right now: I have no clue how to get and work with the data from the sensor channel with delay, as little as possible.

What I got already for the Output:

 

'------------------------------------------------------------------------------ 
Dim oSerialPort

' Initialize COM port
Sub SFD_Init( DeviceParam1V, DeviceParam2V, ErrorP )
  'Open and initialize object
   Set oSerialPort = CreateObject("DIAdem.SFD.UDI") 
  'open the serial port (COM10)
  Call oSerialPort.Open("COM", "COM10")
  'set the baud rate (here 9600 baud)
  Call oSerialPort.ParamSet( "BAUDRATE","9600")
End Sub

' Error
Sub SFD_DeInit(ErrorP )
  ' close the COM port
  oUDIM.Close()
  ' and release the UDI object
  Set oUDIM = Nothing
End Sub


'------------------------------------------------------------------------------ 
'------------------------------------------------------------------------------ 
'Main
'Take the newest value from data channel. If value > 15 write "1" to serial COM port
'------------------------------------------------------------------------------ 
'------------------------------------------------------------------------------ 


pressure_measured =
   While pressure_measured  > 15
	Call oSerialPort.Write("1") 
   Wend

' Close port
oSerialPort.Close() 
 'Delete object :
  Set oUDIM = Nothing
End Sub

'------------------------------------------------------------------------------ 

Thanks for your help!

 

0 Kudos
Message 1 of 1
(1,878 Views)