Board index » delphi » problem with programming a measuring instrument

problem with programming a measuring instrument

------------------------------------------------------------------
 University of Duisburg           | Voice (+49) 203 - 379 3102
 Department of Physical Chemistry | Fax   (+49) 203 - 379 3522
 Lotharstrasse 1, 47057 Duisburg  | WWW titan.uni-duisburg.de/PC/

Hi there !

I want to control a measuring instrument via RS232 (COM1) with TP6.0.
The measuring instrument is controlled by a sequence of ASCII characters.
To read out a value, one has to send a command to the instrument at
first, then the instrument sends back a value.
Does anyone know a simple (!) solution for this problem or are there any
ready made programs to do this ?

So far I tried the simple driver from the TP4.0 handbook. Sending
commands to the instrument was possible, but not receiving data.
When I runned the following program (with the driver from TP6.0):

 

Re:problem with programming a measuring instrument


In article <DFtCxy....@ipswichcity.qld.gov.au> pcla...@gil.ipswichcity.qld.gov.au (Claude Pellerin) writes:

Quote
>>I want to control a measuring instrument via RS232 (COM1) with TP6.0.
>>The measuring instrument is controlled by a sequence of ASCII characters.
>>To read out a value, one has to send a command to the instrument at
>>first, then the instrument sends back a value.
>>Does anyone know a simple (!) solution for this problem or are there any
>>ready made programs to do this ?
>>So far I tried the simple driver from the TP4.0 handbook. Sending
>>commands to the instrument was possible, but not receiving data.
>>When I runned the following program (with the driver from TP6.0):
>Your message appears to have been truncated...
>Anyway, a few comments:
>- Since your instrument only returns data following a prompt from your
>program, there is no need to code an interrupt handler. This makes
>things a lot easier.

Yes, you should simply be able to read and write characters from the port, and
since the response is expected immediately, just busy-wait for the characters.
(Do put this waiting into a very large for-loop so that the program will
time-out after several seconds of getting no response from the device.)

Re:problem with programming a measuring instrument


In article <44gekf$...@h20-hrze.uni-duisburg.de>, Physical Chemistry Department <serv...@x32.uni-duisburg.de> says:

Quote

>Hi there !

>I want to control a measuring instrument via RS232 (COM1) with TP6.0.
>The measuring instrument is controlled by a sequence of ASCII characters.
>To read out a value, one has to send a command to the instrument at
>first, then the instrument sends back a value.
>Does anyone know a simple (!) solution for this problem or are there any
>ready made programs to do this ?

>So far I tried the simple driver from the TP4.0 handbook. Sending
>commands to the instrument was possible, but not receiving data.
>When I runned the following program (with the driver from TP6.0):

A couple of years back, I did just the same thing to control an instrument
(a lock-in amplifier, I seen to recall).
Usually the RS-232 interface of these instruments is only halfway implemented.
On the one in question, the handshake lines were missing...
Anyway, controlling most instruments will work even without waiting for DTR or
other control signals.

e-mail me, and I'll send you the complete source.

Daniel Cejka
daniel.ce...@pki.uib.no
http://www.uib.no/med/avd/ibmb/dan/

Other Threads