Re: using serial port using APIs

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I don't know if RThreshold property setting was a factor in slowing the
response. If it was set to other than 1, then OnComm may not fire at all
when receiving characters(when set to 0), or fire after every RThreshold
characters.



"JamesT" <JamesT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4559C62E-8AE1-4F77-BA01-D0EC45C70191@xxxxxxxxxxxxxxxx
>I have switched to using API Calls and the response is great. I have set a
> timer to 16ms which calls the read code and waits for a poll from the
> device.
> I have also altered the code that builds the transmit message so that it
> does
> it while the timer is waiting to time out. The programme now responds very
> quickly.
>
> Thank you
> --
> JamesT
>
>
> "vbexp" wrote:
>
>> At 9600, 15 bytes(150 Bits) would take 15.625 ms to transmit all the
>> response, or 1.0417 ms for the first byte. Somehow I don't think that the
>> API solution would help you, MSComm could not have possibly be slower
>> than
>> the API by several milliseconds. Here are some links to API solutions
>> anyway:
>>
>> http://groups.google.com/group/microsoft.public.vb.winapi/browse_thread/thread/bcb9856896865bed/a22f8460dab18a8e
>>
>> More:
>>
>> http://groups.google.com/groups?as_q=vb%20setcommconfig%20createfile&num=100
>> http://www.google.com/search?as_q=vb%20setcommconfig%20createfile&num=100
>>
>>
>> "JamesT" <JamesT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:7E071DB1-94B4-4508-B155-83B8149A21DE@xxxxxxxxxxxxxxxx
>> > The baud rate is 9600 and there are only 15 bytes.
>> >
>> > It is the time takes between the mscomm1.output (TxData) command and
>> > the
>> > polling device actually getting the data that is the problem.
>> >
>> > It just takes too long.
>> >
>> > Also I cannot find any help searching for vb setcommconfig.
>> >
>> > Is there an API that will wait for receive data and then inform the
>> > programme that there is data available?
>> >
>> >
>> >
>> > --
>> > JamesT
>> >
>> >
>> > "vbexp" wrote:
>> >
>> >> What baud rate are you using? How many bytes in the response?
>> >>
>> >> It takes 7 ms to send a byte at 1428 baud. Usually, it takes 10 bits
>> >> total
>> >> to send a byte(the byte itself+start and stop bits). So if you are
>> >> sending
>> >> at 38400 Bits/Sec, that is 3840 Bytes/Sec. Each byte takes 260 us, for
>> >> 7
>> >> ms,
>> >> the response can be no more than 26 bytes.
>> >>
>> >> For an API approach, check newsgroups for "vb SetCommConfig"
>> >>
>> >> > I would also like help on making the programme multi threaded so
>> >> > that
>> >> > the
>> >> > comm portion can be started as a separate thread so that the main
>> >> > programme
>> >> > can get on with other things while waiting for a poll.
>> >>
>> >> VB6 is not multi-threaded except for ActiveX EXE's, but even that may
>> >> not
>> >> be
>> >> suitable(global variables are not shared between threads). I recommend
>> >> that
>> >> you design your software in such away that it returns quickly from the
>> >> OnComm event. You can't show a MsgBox in OnComm event. If you have to,
>> >> defer
>> >> it to a Timer.
>> >>
>> >>
>> >> "JamesT" <JamesT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> >> news:A6FC7773-0B28-4302-A777-F89D7DE0E397@xxxxxxxxxxxxxxxx
>> >> >I would like to use the Windows APIs to communicate with a Device
>> >> >connected
>> >> > to the serial port. Can any one suggest good reading material that
>> >> > uses
>> >> > VB6.
>> >> > Most of what I have found gives examples in C++.
>> >> >
>> >> > The Programme is polled every 20ms by the device and the PC has to
>> >> > build
>> >> > the
>> >> > response ( about 7 ms) and reply very quickly. Using the MSComm
>> >> > control
>> >> > is
>> >> > too slow as the reply seems to take about 20ms to get to the device
>> >> > after
>> >> > the
>> >> > MSComm write command.
>> >> >
>> >> > I would also like help on making the programme multi threaded so
>> >> > that
>> >> > the
>> >> > comm portion can be started as a separate thread so that the main
>> >> > programme
>> >> > can get on with other things while waiting for a poll.
>> >> >
>> >> > Please help
>> >> >
>> >> > --
>> >> > JamesT
>> >>
>> >>
>> >>
>>
>>
>>


.



Relevant Pages

  • Re: Did some of us start this way? :)
    ... The 911 system has been in effect for awhile - yet the caller reporting the accident - called a phone number and left a message on an answering machine of the Volunteer Fire Station - which also states at the beginning of the message - if this is an Emergency - please hang up now and dial 911. ... Contrary to that - I've also seen those who "should" have called the EMS and insisted to ignore the symptoms - and end up in dire condition. ... They have "Street" crews, and a quick response of their agencies to relieve the firefighters to go back. ...
    (sci.electronics.design)
  • polytechnic without jolly basin
    ... Until Brion spares the freedoms cautiously, Grover won't fire any detailed careers. ... Hardly any sunny pennys hand Samuel, and they nonetheless obscure Gul too. ... unless Latif reassures floods like Lisette's interval. ... It acknowledged, you shoped, yet Saad never fiercely governed in response to the rear. ...
    (rec.audio.car)
  • Re: Did some of us start this way? :)
    ... When I had a garage fire a few years ago... ... to pull all the firefighters out* and just protect exposures. ... I know - I can be at our station waiting for a crew - my ... Our response time is greatly hampered. ...
    (sci.electronics.design)
  • Re: Whats a good license for My Library?
    ... Unit tests are the well-suited for testing browser features and dom features because each aspect can be tested. ... Specifications should provide guidance for the outcome of assertions and also can help outline an API. ... The adapter makes a call to the server, and when the response comes, you need to verify that response. ... What YUI Test provides is a `wait` method. ...
    (comp.lang.javascript)
  • Re: dont try to type the pupils moreover, endorse them like
    ... fix Kaye's fire with draws, ... fleet in response to the lab. ... Others easily search. ...
    (sci.crypt)