Jim Wagner
2017-04-07 22:07:21 UTC
Greetings -
I seem to have a tough problem here. There are quite a few details so please bear with me.
1. I am trying to set up several virtual (USB) serial ports to talk to multiple microcontroller devices of my design. The devices work through the USB/Serial port as I can access each one, individually, using a standard terminal program. The program is a several year old XOJO app that I wrote so I have at least a little experience with this stuff.
2. Architecturally, I have a class Channel that has a property (class) TheSerial of type Serial. Then I have a module containing a property TheChannels, which is an “array" property of type Channel. There are 8 members of this array.
3. Each class Channel also has a method MySerialDataAvailable that has a parameter TheSerial as Serial. As each new instance of TheChannels is created (using New) and various properties are assigned values and each corresponding instance of TheSerial is Newed, the statement
AddHandler TheChannels(Idx).TheSerial.DataAvailable, AddressOf TheChannels(Idx).MySerialDataAvailable
is executed. The purpose is to give TheChannels(Idx).TheSerial a DataAvailable event handler. Yes, TheSerial is Newed before this statement is executed!
4. When I write a predetermined command to the virtual serial port using TheChannels(Idx).TheSerial.Write(CommandString), I can see the Rx LED flash on the remote device, indicating that the command was received and the Tx LED on the remote device flash, indicating that a response was transmitted (exactly the same as when the ordinary terminal program was used).
5. HOWEVER, the DataAvailable event never fires. I suspect that there is something wrong with the AddHandler statement but I am at a loss to see what it is or how to diagnose what it might be or even to determine whether or not that is, in fact, the problem. In particular, do I have the AddressOf specification correct?
Hope someone with a bit of experience can help point me in a useful direction.
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_____________________________________________
I seem to have a tough problem here. There are quite a few details so please bear with me.
1. I am trying to set up several virtual (USB) serial ports to talk to multiple microcontroller devices of my design. The devices work through the USB/Serial port as I can access each one, individually, using a standard terminal program. The program is a several year old XOJO app that I wrote so I have at least a little experience with this stuff.
2. Architecturally, I have a class Channel that has a property (class) TheSerial of type Serial. Then I have a module containing a property TheChannels, which is an “array" property of type Channel. There are 8 members of this array.
3. Each class Channel also has a method MySerialDataAvailable that has a parameter TheSerial as Serial. As each new instance of TheChannels is created (using New) and various properties are assigned values and each corresponding instance of TheSerial is Newed, the statement
AddHandler TheChannels(Idx).TheSerial.DataAvailable, AddressOf TheChannels(Idx).MySerialDataAvailable
is executed. The purpose is to give TheChannels(Idx).TheSerial a DataAvailable event handler. Yes, TheSerial is Newed before this statement is executed!
4. When I write a predetermined command to the virtual serial port using TheChannels(Idx).TheSerial.Write(CommandString), I can see the Rx LED flash on the remote device, indicating that the command was received and the Tx LED on the remote device flash, indicating that a response was transmitted (exactly the same as when the ordinary terminal program was used).
5. HOWEVER, the DataAvailable event never fires. I suspect that there is something wrong with the AddHandler statement but I am at a loss to see what it is or how to diagnose what it might be or even to determine whether or not that is, in fact, the problem. In particular, do I have the AddressOf specification correct?
Hope someone with a bit of experience can help point me in a useful direction.
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_____________________________________________