I have usb device (trueRNG) producing random bytes (comparable with a 'mad modem'). I am using the serial control to read it. It works fine under Mac but it fails under Windows. I found the proper port number and initialize the port as follows:
W_serial.Serial1.SerialPort = system.serialport(portnumber)
W_serial.serial1.RequestToSend= false // don't request data yet
W_serial.Serial1.Baud=W_serial.Serial1.Baud9600 // or 2
W_serial.Serial1.Parity=W_serial.Serial1.ParityNone // or 0
W_serial.Serial1.Bits=3 //8 bits.
W_serial.Serial1.Stop=W_serial.Serial1.StopBits15 //or 1
if (W_serial.Serial1.open)=false then
msgbox("failed to open the RNG")
W_serial.Serial1.close 'and close again
The error event in serial1 produces a msg box. To read I ope the port, set requesttosend and wait in a loop till the data-available event is triggered. On Windows I find the port number using different code but after that I use the same approach to read. However the serial1 error event fires immediately upon trying to open the serial device. Of course the open method then returns a failure.
What can be wrong. On the Mac it works without a driver. Maybe the lack of specification of serial1.InputDriverName is the culprit. I have no experience with windows (don't know how drivers are installed and how in general drivers are referred to). But it could be a totally different reason. !@#$%