Serial communication

Serial communication

Post by Dennis Heue » Mon, 11 Aug 2003 19:01:02



Hello together,

my problem is the following.
I have to head for an electronic totals counter via serial interface.
The environment I'm working with is a Compaq Prolinea 4/66 with MSDOS 6.0.
Over the serial interface it is possible to call data up and to
reprogram parameters in the counter.
Here now my questions:
Does someone know, where I find a guidance, how I can provide such a
communication?
To send and receive ASCII character sets about the serial interface.
And this - if possible - real-time!
Which programming language is suitable for the programming of such a
program.
It should be as simply as possible knitted.
I had thought first of Ansi C, but I am encountered my searches to my
borders in things C here.
QBasic would still offer itself according to to my opinion.
It would be very kind an helpfull when you could send me some links or
source-texts.

Best wishes

Dennis

(Sorry for my terrible english)

 
 
 

Serial communication

Post by Matt Claesse » Mon, 11 Aug 2003 19:51:38



Quote:> Hello together,

> To send and receive ASCII character sets about the serial interface.
> And this - if possible - real-time!
> Which programming language is suitable for the programming of such a
> program.

Hi,

If you want to use Basic, go ahead, it supports the COMM ports fine,
in my experience (GWBasic).
MSoft put this support in Basic, but unfortunately, all other languages need
external libraries to support interrupt driven communication.
So, if you use Pascal or C, get a library. There are many of them around.
Do NOT waste your time trying to use the BIOS routines. Receiving
data is polled only, it will only work at very low speeds, or not at all.

regards, Matt

 
 
 

Serial communication

Post by Alex Russel » Tue, 12 Aug 2003 01:39:40





> > Hello together,

> > To send and receive ASCII character sets about the serial interface.
> > And this - if possible - real-time!
> > Which programming language is suitable for the programming of such a
> > program.

> Hi,

> If you want to use Basic, go ahead, it supports the COMM ports fine,
> in my experience (GWBasic).
> MSoft put this support in Basic, but unfortunately, all other languages
need
> external libraries to support interrupt driven communication.
> So, if you use Pascal or C, get a library. There are many of them around.
> Do NOT waste your time trying to use the BIOS routines. Receiving
> data is polled only, it will only work at very low speeds, or not at all.

> regards, Matt

serial.c inside common.zip at
http://www3.telus.net/alexander_russell/

has c code for serial i/o. Allows you to send and recieve via a standard
serial port using interrupt driven i/o which works very well.

--
Alex Russell

 
 
 

Serial communication

Post by Dennis Heue » Wed, 13 Aug 2003 03:45:51


I tried the following code but both codes are not working!
Perhaps somebody can help me here.

My computer have to send this ASCII-Code: <STX>35IT<ETX>
After sending this code, the external counter sends, and my computer
receive this code: <STX>35N21401<ETX><CR>
Where is the failure in my code???

Code 1:

40 OPEN "COM1:4800,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1
50 PRINT #1, CHR$(2); "54IT"; CHR$(3); CHR$(13);
60 LINE INPUT #1, IN$
70 PRINT IN$
80 CLOSE #1
90 END

Code 2:

40 OPEN "COM1:4800,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1
50 PRINT #1, CHR$(2);
51 PRINT #1, "54IT";
53 PRINT #1, CHR$(3);
54 PRINT #1, CHR$(13)
60 LINE INPUT #1, IN$
70 PRINT "Ausgabe: "; IN$
80 CLOSE #1
90 END

Dennis Heuer schrieb:

Quote:> Hello together,

> my problem is the following.
> I have to head for an electronic totals counter via serial interface.
> The environment I'm working with is a Compaq Prolinea 4/66 with MSDOS 6.0.
> Over the serial interface it is possible to call data up and to
> reprogram parameters in the counter.
> Here now my questions:
> Does someone know, where I find a guidance, how I can provide such a
> communication?
> To send and receive ASCII character sets about the serial interface.
> And this - if possible - real-time!
> Which programming language is suitable for the programming of such a
> program.
> It should be as simply as possible knitted.
> I had thought first of Ansi C, but I am encountered my searches to my
> borders in things C here.
> QBasic would still offer itself according to to my opinion.
> It would be very kind an helpfull when you could send me some links or
> source-texts.

> Best wishes

> Dennis

> (Sorry for my terrible english)

 
 
 

Serial communication

Post by R.Wiese » Wed, 13 Aug 2003 06:48:32




Hello Dennis,

Quote:> I tried the following code but both codes are not working!
> Perhaps somebody can help me here.

> My computer have to send this ASCII-Code: <STX>35IT<ETX>
> After sending this code, the external counter sends, and my computer
> receive this code: <STX>35N21401<ETX><CR>
> Where is the failure in my code???

Neither of your routines will actually send the above mentioned data ...
Instead they will send 54IT, not 35IT :-)

But on to the problem : As I have no idea what the external computer
*should* send, I can't say what's wrong ....   Your code-samples look o.k. ,
although the second sample will send an extra CR-LF combination at the end
due to a missing/forgotten semy-colon ( ";" ).

It's possible that your Line Input does not work, due to the fact that the
response does not contain a CR-LF combination ...  Have you tried to grab
single chars (using input$(1,#1) ), until you see a <CR> ?

[Snip]

Regards,
  Rudy Wieser

 
 
 

Serial communication

Post by H-Ma » Thu, 14 Aug 2003 00:24:34


Often you'll have to wait for some output from the counter. If you know
exactly how long the receive string will be, then you can continue to poll
the input buffer one chacater at a time until you get the right number of
charactes back. The following code is something I scribbled up to
communicate with a Red Lion meter, the same sort of thing applies though.
This code will wait up to 1/4 second for a response from the meter.

*****************************************************************
'RLC Comm Program for IM meters'
Start:
CLS : CLOSE
LOCATE 1, 1, 1
ON ERROR GOTO Errmess
OPEN "COM1:9600,N,8,1,CS,DS" FOR RANDOM AS #1

'transmitt from computer'
B$ = INKEY$: IF B$ <> "" THEN PRINT B$; : PRINT #1, B$;
IF B$ = "*" THEN PRINT
IF B$ = CHR$(27) THEN PRINT "RETURN TO DOS": END

'receive data from IM'
t = 0

delaystart! = TIMER

DO
IF INKEY$ = CHR$(27) THEN GOTO Start
IF NOT EOF(1) THEN EXIT DO
delaytime! = TIMER - delaystart!
IF delaytime! > .25 THEN EXIT DO
LOOP

IF EOF(1) THEN GOTO Start

c = 0
DO
ON ERROR GOTO Errmess
data$ = INPUT$(1, #1)
c = c + 1
IF c = 1 THEN IF data$ <> "-" THEN PRINT " ";
IF c = 1 THEN IF data$ <> "*" THEN PRINT " ";
IF data$ = CHR$(13) OR data$ = CHR$(10) THEN PRINT "  ";  ELSE PRINT data$;
IF data$ = CHR$(10) THEN EXIT DO
IF INKEY$ = CHR$(27) THEN GOTO Start
LOOP

Errmess: PRINT "ERROR NO."; ERR: RESUME
END
*****************************************************************
Hope this helps
HK


Quote:> I tried the following code but both codes are not working!
> Perhaps somebody can help me here.

> My computer have to send this ASCII-Code: <STX>35IT<ETX>
> After sending this code, the external counter sends, and my computer
> receive this code: <STX>35N21401<ETX><CR>
> Where is the failure in my code???

> Code 1:

> 40 OPEN "COM1:4800,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1
> 50 PRINT #1, CHR$(2); "54IT"; CHR$(3); CHR$(13);
> 60 LINE INPUT #1, IN$
> 70 PRINT IN$
> 80 CLOSE #1
> 90 END

> Code 2:

> 40 OPEN "COM1:4800,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1
> 50 PRINT #1, CHR$(2);
> 51 PRINT #1, "54IT";
> 53 PRINT #1, CHR$(3);
> 54 PRINT #1, CHR$(13)
> 60 LINE INPUT #1, IN$
> 70 PRINT "Ausgabe: "; IN$
> 80 CLOSE #1
> 90 END

> Dennis Heuer schrieb:
> > Hello together,

> > my problem is the following.
> > I have to head for an electronic totals counter via serial interface.
> > The environment I'm working with is a Compaq Prolinea 4/66 with MSDOS
6.0.
> > Over the serial interface it is possible to call data up and to
> > reprogram parameters in the counter.
> > Here now my questions:
> > Does someone know, where I find a guidance, how I can provide such a
> > communication?
> > To send and receive ASCII character sets about the serial interface.
> > And this - if possible - real-time!
> > Which programming language is suitable for the programming of such a
> > program.
> > It should be as simply as possible knitted.
> > I had thought first of Ansi C, but I am encountered my searches to my
> > borders in things C here.
> > QBasic would still offer itself according to to my opinion.
> > It would be very kind an helpfull when you could send me some links or
> > source-texts.

> > Best wishes

> > Dennis

> > (Sorry for my terrible english)

 
 
 

Serial communication

Post by Nuno Ventur » Thu, 14 Aug 2003 20:09:15


I just use C for comunications and in fact it's more dificult than basic.
For comunications troubleshoot (in any language) I use and sugest he
following:
1 - Conect the device to one PC with Procomm (or hyperterminal, but Procomm
is better because you can map <stx><cr> or any character to a visible
caracter) and see if it sends what the manual says. In your case you must
use procomm to send the 35IT string in order to receive something.
2 - Conect the PC with your program to another PC with procomm and see if
the message that you think your PC send is really sent.
Usually with this 2 steps you can find what is the problem. You can also
have strange caracters that means the comunication parameters not ok (speed,
parity, etc) or if you dont get nothing, it can be the cable or one of the
ports (try procomm betwen the 2 PCs)

I hope this help.
May be there are utilities as good as procomm. This is the one I use (a very
old version for ms-dos)
Nuno Ventura


Quote:> I tried the following code but both codes are not working!
> Perhaps somebody can help me here.

> My computer have to send this ASCII-Code: <STX>35IT<ETX>
> After sending this code, the external counter sends, and my computer
> receive this code: <STX>35N21401<ETX><CR>
> Where is the failure in my code???

> Code 1:

> 40 OPEN "COM1:4800,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1
> 50 PRINT #1, CHR$(2); "54IT"; CHR$(3); CHR$(13);
> 60 LINE INPUT #1, IN$
> 70 PRINT IN$
> 80 CLOSE #1
> 90 END

> Code 2:

> 40 OPEN "COM1:4800,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1
> 50 PRINT #1, CHR$(2);
> 51 PRINT #1, "54IT";
> 53 PRINT #1, CHR$(3);
> 54 PRINT #1, CHR$(13)
> 60 LINE INPUT #1, IN$
> 70 PRINT "Ausgabe: "; IN$
> 80 CLOSE #1
> 90 END

> Dennis Heuer schrieb:
> > Hello together,

> > my problem is the following.
> > I have to head for an electronic totals counter via serial interface.
> > The environment I'm working with is a Compaq Prolinea 4/66 with MSDOS
6.0.
> > Over the serial interface it is possible to call data up and to
> > reprogram parameters in the counter.
> > Here now my questions:
> > Does someone know, where I find a guidance, how I can provide such a
> > communication?
> > To send and receive ASCII character sets about the serial interface.
> > And this - if possible - real-time!
> > Which programming language is suitable for the programming of such a
> > program.
> > It should be as simply as possible knitted.
> > I had thought first of Ansi C, but I am encountered my searches to my
> > borders in things C here.
> > QBasic would still offer itself according to to my opinion.
> > It would be very kind an helpfull when you could send me some links or
> > source-texts.

> > Best wishes

> > Dennis

> > (Sorry for my terrible english)

 
 
 

1. Serial Communication with a PC with no Communication Software.

LapLink in their advertisemnts claim, and their claim is confirmed by
users, that it is not neccessary to install LapLink on both computers
that are about to communicate, as LapLink is able to install itself automati-
cally over the serial channel.

That is, I think, a very interesting feature, but it puzzles me how they are
able to achieve it. Does there exist a undocumented DOS capability to load
and then execute programs via the serial ports? That would mean that some
kind of interrupt service routine exists for them. Yet, as far as I know, DOS
does not support interrupt driven serial communications. In case such capabi-
lities exist, it would be useful that they become more widely known.

There is also the possibility that LapLink relies on the user to give the
CTTY COM1 command that will give control of the PC to the serial line and thus
to LapLink running on the other PC. But the claim for automatic install is not
exactly accurate in that case.

Any ideas, thoughts, or information would be appreciated.

E.A.Neonakis
Heraclion, Crete, Hellas.

2. Xbox Live?

3. Serial Communication

4. Ghost image breaking up

5. Serial communications software

6. Trying to use MIDI Under OS/2

7. low level serial communications

8. zone alarm pr0 3.0

9. Serial communication

10. writing c++ code for serial communication (com1 or com2).

11. ANNOUNCE : DZComm 0.5.1 (serial communication add-on for Allegro)

12. Serial communication

13. C Programmer's Guide to Serial Communications software needed