Searching \ for '[OT]: qbasic' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/language/index.htm?key=basic
Search entire site for: 'qbasic'.

Exact match. Not showing close matches.
PICList Thread
'[OT]: qbasic'
2000\08\22@191937 by Joe

flavicon
face
I'm having trouble sending to the list.  I hope this makes it.

I need an example in qbasic for writing to and immediately reading the data
sent to the serial port.  I can tie transmit to receive and also DTR and RTS
but would like to use no handshaking.
My program crashed repeatedly until I found out you have to send a carriage
return (is there a way around this?)  before the program quits reading data.
Even now it always says the data received is 0 no matter what I do.  Help!

I would like an example that wouldn't crash if data was not received but
anything would be greatly appreciated.

Thanks.

Joe

e-mail me @  - spam_OUTjoeh100TakeThisOuTspamcrosswinds.net

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:" PIC only "[EE]:" engineering "[OT]:" off topic "[AD]:" ad's


2000\08\22@201432 by hard Prosser

flavicon
face
How are you reading the input?

If you are using a standard INPUT #1 (etc.)  statement then I think you're
stuck with the carrage return.
However if you use a$=INPUT(1,1) and input byte by byte then you can
examine each byte for your own terminator. Alternatively you can use a
$=INPUT(1,n) -or is it (n,1)- to input a fixed number of bytes (n).

I think there's another INPUT type statement that can be used as well -
can't remember too well but I have done this sort of thing - a long time
ago.- and can remember having this sort of problem.

Hope this helps - I don't have qbasic on this machine but can look it up
when I get home if you're still stuck

Richard P





                   Joe
                   <joeh100@CROSS        To:     .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
                   WINDS.NET>            cc:
                   Sent by: pic          Subject:     [OT]: qbasic
                   microcontrolle
                   r discussion
                   list
                   <PICLIST@MITVM
                   A.MIT.EDU>


                   23/08/00 11:19
                   Please respond
                   to pic
                   microcontrolle
                   r discussion
                   list





I'm having trouble sending to the list.  I hope this makes it.

I need an example in qbasic for writing to and immediately reading the data
sent to the serial port.  I can tie transmit to receive and also DTR and
RTS
but would like to use no handshaking.
My program crashed repeatedly until I found out you have to send a carriage
return (is there a way around this?)  before the program quits reading
data.
Even now it always says the data received is 0 no matter what I do.  Help!

I would like an example that wouldn't crash if data was not received but
anything would be greatly appreciated.

Thanks.

Joe

e-mail me @  - joeh100spamKILLspamcrosswinds.net

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:" PIC only "[EE]:" engineering "[OT]:" off topic "[AD]:" ad's

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
"[PIC]:" PIC only "[EE]:" engineering "[OT]:" off topic "[AD]:" ad's


2000\08\23@043439 by Alan B. Pearce

face picon face
>I would like an example that wouldn't crash if data was not received but
>anything would be greatly appreciated.

One way to do this is use the "On Com Event" subroutine. It is a long while
since I played with "on event" things, but from memory the major hassle is the
subroutine you leap out to when the event happens has to be a label in the
highest level code, i.e. it cannot be a "Function" or "Sub" routine. Inside the
routine you could then get the individual characters as someone else suggests.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2000\08\23@100615 by Robert A. LaBudde

flavicon
face
At 09:33 AM 8/23/00 +0100, Alan wrote:
> >I would like an example that wouldn't crash if data was not received but
> >anything would be greatly appreciated.
>
>One way to do this is use the "On Com Event" subroutine. It is a long while
>since I played with "on event" things, but from memory the major hassle is the
>subroutine you leap out to when the event happens has to be a label in the
>highest level code, i.e. it cannot be a "Function" or "Sub" routine.
>Inside the
>routine you could then get the individual characters as someone else suggests.

It's much simpler to use direct I/O instead of relying on the event routines.

Here's a code fragment for reading COM1:

          OPEN "com1:2400,n,8,2,cd0,ds0,cs,rs,rb16" FOR INPUT AS #1
          DO WHILE ABS(StartTime - TIMER) < Delay: LOOP    'wait Delay secs
          IF NOT EOF(1) THEN
            IF LOF(1) > 1 THEN
              PRINT "Received characters: ["; INPUT$(LOF(1), 1); "]"
            END IF
          END IF

You should look at the help file for "OPEN COM" to get info about the OPEN
statement options. Here is a brief summary:

OPEN "COM1:opt1[opt2]" [FOR mode] AS
  #file [LEN=n]
Opt1: speed,parity,data,stopbits
    300-9600 NEO   7|8  1|1.5|2
Opt2: ASC = tab expand,^Z,CR force
  LF = for ASC, force LF after CR
  RB[n]=rx buffer; 512 default
  TB[n]=tx buffer; ?
  RS = suppress RTS
  CD[n]=timeout CD in ms, 0 ignore; 0
  CS[n]=timeout CTS in ms, 0 ignore;1000

DS[n]= timeout DSR ms, 0 ignore; 1000
OP[n]= wait for line ms; 10x CD or DS or
        10000 (10s)
NOTE: good to use longest time for OP
ERDEV=128  CTS timeout
     =129  DSR timeout
     =130  CD timeout

E.g.: "COM1:1200,N,8,1,RS,CS0,DS0,CD0,
        RB8192"


================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: .....ralKILLspamspam.....lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"
================================================================

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...