Re: ActiveX.exe more problems
- From: "Galen Somerville" <galen@xxxxxxxxxxxx>
- Date: Fri, 2 Jun 2006 18:19:05 -0700
"Schmidt" <sss@xxxxxxxxx> wrote in message
news:uGi7zmohGHA.1276@xxxxxxxxxxxxxxxxxxxxxxx
"Galen Somerville" <galen@xxxxxxxxxxxx> schrieb im Newsbeitrag
news:em0EminhGHA.2364@xxxxxxxxxxxxxxxxxxxxxxx
I hear you but my thinking goes this way...I hear you too ;-), but that's not, how it should be done IMO.
I think about your USB-Device as a "Streaming-Device", wich
samples your incoming data continously (more or less, there
are probably some FIFOs involved).
And that's my problem, it's not a Streaming device. Jungo assumes this too
and their new drivers for NET are basically made that way. That's why I'm
going to use a VB6 dll as I can then use Jungo as "send commands" and "get
replies".
Probably 98% of USB devices stream data from a hard drive, scanner, etc.
Mine doesn't.
So, as long as you want to visualize continously, keep the Thread
(wich recieves these continous data from your device) alive.
No need, to kill the thread after receiving a single "line of data".
As long as you want to continously visualize inside your Application,
as long lives and captures the thread your USB-Data.
Both the App and the USB device know exactly what isNot exactly sure, what you mean with this.
happening.
Both the App and the USB device automatically stop processing after 1,020
pixels of data. No communications between them saying they are done. If the
App doesn't see an Abort or Stop flag it starts interrogating the USB device
until it sees that the Trigger level has been reached. Then the whole 1,020
pixel operation starts over again.
So in MainLoop would be this:
For Index = 0 To Count - 1As said, no need to limit the Threads LiveTime to a single line of data.
It's not a single line of data. The thread will be alive for 170 transfers
of 24 byte packets. Each packet will raise an event so the App can draw
partial traces while the next packet is being received. Packets are received
every 14 ms typically. This depends on the Heart rate and number of beats
displayed. Could be shorter or much longer intervals.
Stat = WDU_TransferInterrupt(Dev, 129, True, 0, VarPtr(DatAry(0)),Ok, but better with DatAry(s), sitting in Ringbuffer-Slots ;-)
Quant, Xsfrd, Twait)
If Stat <> STATUS_SUCCESS Thenbetter (enhance the SharedData-Type appropriately):
sMsg2 = Stat2Str(Stat)
End If
If Stat <> STATUS_SUCCESS Then
SharedArr(0).StatErrNr = Stat
Goto ex 'let's exit the DeviceLoop
End If
RaiseEvent CheckBufferNo, no way, really - this is exactly the point, that brings all
the trouble into the game (CrossThread-Event-Marshaling
with all those potential blocking-issues)
The raised event "CheckBuffer" is just a rename of the
"CheckRingBufferQueue"
Raising the event was just moved from the Form to the Class
And in Cmain would be this:No, this type of Event-Cascading between the Threads is
Private Sub CallbackForm_CheckBuffer()
RaiseEvent BurstEvent(DatAry)
End Sub
simply not the way to go, if a stable capturing is your goal.
Definitely go with the RingBuffer - it is visible to both threads
at the same time. Inside CMain, wich runs on the same thread
as the whole App, you only have to check, where the last
RingBuffer-Index points to - the data is already filled in at
that point by CThread.
If the DatAry was Public in the bas module isn't it visible to both threads
just like the ring buffer?
Feel free to ask about the whole construct, if you not fully
understand, how it works with all those Modulo-Operations
on the Indices.
Sometimes I have to use my fingers, if I have to deal with
such stuff (and proof offsets and shiftings) myself.
I think I'm also using my toes. (g)
Galen
Public Event BurstEvent(DatAry() As Byte)Ok, as recommended.
Olaf
.
- Follow-Ups:
- Re: ActiveX.exe more problems
- From: Schmidt
- Re: ActiveX.exe more problems
- References:
- Re: ActiveX.exe more problems
- From: Schmidt
- Re: ActiveX.exe more problems
- From: Schmidt
- Re: ActiveX.exe more problems
- From: Galen Somerville
- Re: ActiveX.exe more problems
- From: Schmidt
- Re: ActiveX.exe more problems
- From: Galen Somerville
- Re: ActiveX.exe more problems
- From: Schmidt
- Re: ActiveX.exe more problems
- Prev by Date: Re: webbrowser control to submit form
- Next by Date: Re: Shortcut key and tab problems
- Previous by thread: Re: ActiveX.exe more problems
- Next by thread: Re: ActiveX.exe more problems
- Index(es):
Relevant Pages
|