Reading from COM1: (Clipper S'87 or Clipper 5.2) 
Author Message
 Reading from COM1: (Clipper S'87 or Clipper 5.2)

Hello,
Can anyone tell me how to read from COM1: p.e. and store its contents in
mydb?
Everytime mydb will be updated with one character, instead of the whole
string that is displayed on screen.
Thanks in advance,

Paul van Meer

My Example:
*------------------------------------------------------------------
CLEAR
SET DATE ITALIAN
SET CENTURY ON
pEsc := 27
cPort := 1
nBuffSize := 256

COM_CLOSE(cPort)
COM_OPEN(cPort,nBuffSize,.T.)
COM_INIT(cPort,2400,"E",7,2)

ComOk  :=  COM_OPEN(cPort, nBuffSize)

IF .NOT. ComOk
   ? "COM"+STR(cPort,1)+": "+"Port cannot be opened!"
ENDIF

USE mydb ALIAS app

DO WHILE .T.
   kPress := INKEY()
   DO WHILE COM_COUNT(cPort) < 256        // until 256 characters are in
buffer
      *...
   ENDDO
   cInput := COM_READ(cPort,256)
   ?? cInput                                                           //
display buffer on screen
   COM_BREAK(cPort,200)                               // wait 200
milliseconds
   SELECT app
   APPEND BLANK
   REPLACE  pDate  WITH DATE() ,  pTime    WITH SECONDS() ,  pValue WITH
cInput
   IF kPress = pEsc
      EXIT
   ENDIF
ENDDO
DO pclose                                                        // read
last buffer etc. & close program
RETURN



Fri, 06 Sep 2002 03:00:00 GMT  
 Reading from COM1: (Clipper S'87 or Clipper 5.2)
Perhaps the problem is related to opening the COM port twice?

Quote:
> COM_CLOSE(cPort)
> COM_OPEN(cPort,nBuffSize,.T.)
> COM_INIT(cPort,2400,"E",7,2)

> ComOk  :=  COM_OPEN(cPort, nBuffSize)

Instead of opening the COM port a second time, put the "ComOk := " in front
of the first COM_OPEN call...
--
David G. Holm


Fri, 06 Sep 2002 03:00:00 GMT  
 Reading from COM1: (Clipper S'87 or Clipper 5.2)
Hello there,

i have a small problem in reading the contents of the com-port ...
this is my situation :
1, user opens DOS-bow 1 and uses com-port trough clipper application
2, application closes com-port and terminates in a normal way, but dos box
stays open
3, second dos box opens and tries to open the com port using com_open() from
CT.LIB. Com_Open returns .t., so the com_port could be opened.
4, when the application tries to read from the com port, no data is coming
in, however, there is data on the com port.

It seems that win 95 can not assign the com port to a second dos box, if
there is a first dos window that has been using the com port, even if the
com port has been correctly closen in the first dos box. If you close both
dos-windows, and you start the application goes just fine.

Can anyone give me a reason for this problem ?
Why doesn't com_open report a problem ? The function COM_MSR() reports 255
in the second does box, which indicates that there is something wrong.
can anyone give a solution ?


Quote:
>Perhaps the problem is related to opening the COM port twice?

>> COM_CLOSE(cPort)
>> COM_OPEN(cPort,nBuffSize,.T.)
>> COM_INIT(cPort,2400,"E",7,2)

>> ComOk  :=  COM_OPEN(cPort, nBuffSize)

>Instead of opening the COM port a second time, put the "ComOk := " in front
>of the first COM_OPEN call...
>--
>David G. Holm



Sat, 14 Sep 2002 03:00:00 GMT  
 Reading from COM1: (Clipper S'87 or Clipper 5.2)
On Tue, 28 Mar 2000 17:02:31 GMT, <(no spam)

Quote:

>Hello there,

>i have a small problem in reading the contents of the com-port ...
>this is my situation :
>1, user opens DOS-bow 1 and uses com-port trough clipper application
>2, application closes com-port and terminates in a normal way, but dos box
>stays open
>3, second dos box opens and tries to open the com port using com_open() from
>CT.LIB. Com_Open returns .t., so the com_port could be opened.
>4, when the application tries to read from the com port, no data is coming
>in, however, there is data on the com port.

>It seems that win 95 can not assign the com port to a second dos box, if
>there is a first dos window that has been using the com port, even if the
>com port has been correctly closen in the first dos box. If you close both
>dos-windows, and you start the application goes just fine.

>Can anyone give me a reason for this problem ?
>Why doesn't com_open report a problem ? The function COM_MSR() reports 255
>in the second does box, which indicates that there is something wrong.
>can anyone give a solution ?

Try putting this line in SYSTEM.INI in the [386Enh] section:
Com1AutoAssign=2

This works for me...

--
Nick Ramsay
WitzEnd Computer Services UK



Sat, 14 Sep 2002 03:00:00 GMT  
 Reading from COM1: (Clipper S'87 or Clipper 5.2)

Frederic

You might like to do a search on microsoft msdn site for a work around, I
think I've seen messages here that it's a Windows problem/feature.

--
HTH
Steve Quinn
A SKEPTIC is one who won't take "know" for an answer.


Quote:
> Hello there,

> i have a small problem in reading the contents of the com-port ...
> this is my situation :
> 1, user opens DOS-bow 1 and uses com-port trough clipper application
> 2, application closes com-port and terminates in a normal way, but dos box
> stays open
> 3, second dos box opens and tries to open the com port using com_open()
from
> CT.LIB. Com_Open returns .t., so the com_port could be opened.
> 4, when the application tries to read from the com port, no data is coming
> in, however, there is data on the com port.

> It seems that win 95 can not assign the com port to a second dos box, if
> there is a first dos window that has been using the com port, even if the
> com port has been correctly closen in the first dos box. If you close both
> dos-windows, and you start the application goes just fine.

> Can anyone give me a reason for this problem ?
> Why doesn't com_open report a problem ? The function COM_MSR() reports 255
> in the second does box, which indicates that there is something wrong.
> can anyone give a solution ?

> David G. Holm heeft geschreven in bericht


- Show quoted text -

Quote:
> >Perhaps the problem is related to opening the COM port twice?

> >> COM_CLOSE(cPort)
> >> COM_OPEN(cPort,nBuffSize,.T.)
> >> COM_INIT(cPort,2400,"E",7,2)

> >> ComOk  :=  COM_OPEN(cPort, nBuffSize)

> >Instead of opening the COM port a second time, put the "ComOk := " in
front
> >of the first COM_OPEN call...
> >--
> >David G. Holm



Sun, 15 Sep 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. FS: Used Clipper S'87, 5.01, 5.2 and 5.3

2. Print Screen - Summer '87 (well clipper 5.2 for sure)

3. HELP--CLIPPER '87 to 5.2 Conversion

4. Clipper 87 => 5.2 - Alias Problems

5. Conversion Summer 87 --> Clipper 5.2

6. Problems with upgrade from Clipper 87 to 5.2

7. Clipper Expert (S'87 - Clipper 5.3) needed in Atlanta area

8. Clipper '87 and printing under W'95

9. CLIPPER '87 '85 and Netware

10. clipper.lib for Clipper 87

11. seeking clipper summer-87 disks and perhaps a more recent version of clipper

12. conversion clipper 87 to clipper 5

 

 
Powered by phpBB® Forum Software