you asked on Wed, 3 Mar 2004 17:48:37 +0800:
I have been in your situation several times.I have been working with a vi witch connects to a serial port and reads load and displacement, how can I simulate the type of data I would normally be receiving , so that I can test everything thoroughly, without actually connecting to the instrument at work. There is a peak load detection and clear indicator function as well as some front panel indicators that blink according to when a comparison has been made. Thanks in advance, any help examples in V6 would be greatly appreciated.
There have been many different architectures for serial drivers.
A key problem in all of 'em is a stage that handles messaging, say sending out messages to the device and receiving completely tested messages from the device.
What I often do is coding this level driver with an USR that holds any incomplete messages for the next call. At this level you can easily insert a string constant and fill it with data captured from a test run with your real instrument. Than insert a boolean control 'demo' that defaults to FALSE. If it is true your driver should take some (random number) of characters from the string constant rather than from the device. Sometimes I also added another peace of code that could copy all chars from the device to a string display or a file in order to look what the raw data REALLY looks like.
Device documentation is often not so clear or updated or exact. And debugging a running device's output stream can easily flood any system and program buffers. So with a file buffer one gets a chance to revisit the data and processing of raw data without the pushing device in the background.
Greetings from Germany! -- Uwe Frenz
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dr. Uwe Frenz Entwicklung getemed Medizin- und Informationtechnik AG Oderstr. 59 D-14513 Teltow
Tel. +49 3328 39 42 0 Fax +49 3328 39 42 99 [EMAIL PROTECTED] WWW.Getemed.de