Mail Archives: djgpp/1998/08/26/01:45:22
Neil Townsend wrote:
> In comp.os.msdos.djgpp Jerzy Witkowski
> <Jerzy DOT Witkowski AT ii DOT uni DOT wroc DOT pl> writes:
> >From `bcserio/readme' file:
>
> >2. I tried to connect with old digital multimeter. In its
> >instruction I found a small program in BASIC with the following
> >statement:
> >
> >OPEN #1,"COM2,1200,n,7,2,RS,DS,TR,DS"
> >(ooops, sorry, I forgot the instruction, so it is written from
> >memory and surely contains mistakes - I'll check it if needed).
>
> I can hazard a guess:
>
> The program is opening the COM2 port and setting it as follows:
>
> 1200 baud
> n no parity
> 7 data bits
> 2 stop bits
>
> the other bits will be about the handshaking protocol used, about
> which I
> know nothing. The documentation of the multimeter might give you a
> hint as
> might the manual for the version of basic you are using.
>
> >Could you explain (very generally) what these two letter words
> >mean and how could I obtain this functionality with `bcsio'
> >package?
>
> I would use the term program that comes with the bcserio package (you
> will
> need to compile this one:
>
> gcc -c term.c -o term.o
> gcc -o term.exe term.o serio.o
> ).
>
> term -help give help
>
> term -com2:1200,n,7,2
>
> will emulate the above with no handshaking, which may or may not be
> what you
> want.
>
> Neil
> --
> Neil Townsend +44 (1865) 273121 neil AT robots DOT ox DOT ac DOT uk
The two letter abbreviations are the status lines. Think that you may
have copied them not quite right from memory.
RS - Request to Send pin 4 of 25 pin RS232 connector
CS - Clear to Send pin 5
TR - Terminal Ready pin 20 ( also called DTR for Data Terminal
Ready)
DS - Data Set Ready pin 6
This is the most likely combination. Your computer needs to raise TR
active, this permit the voltmeter to raise DS active permitting the
usart to be functionable. The voltmeter should provide RS active when
it is ready to send a volt reading thus asking if your program is ready
to receive the data. When your program is ready to receive the data then
CS is set active by your program for each byte of data. Your program
then drops CS until the byte in the usart is in a buffer then CS is
raised active again and this cycle is repeated until all bytes are
received.
These four indicators (plus others) can be shown as on/off indicators on
the terminal screen to better see what is occurring. The Basic source
code should show how that is accomplished. The interrupt irq3 needs to
be intercepted. so that the interrupt code places the usart byte into a
ring char array. Your program then should extract the data when time
permits. Probably there are two pointers for this (one for putting in
the byte and the other for the extraction). The process stops when both
pointers occupy the same memory location indicating all data has been
received to that point.
Thomas
- Raw text -