Announcement

Collapse
No announcement yet.

Comm and Width

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mel Bishop
    replied
    Aldo's post got me curious so I finally found an old x486 running
    pure dos 6.2 with a modem in it. Wrote the following test code:
    Code:
            $lib all off
            $lib com on
            color 14,1
            cls
    
            a$ = string$(80,"A")
    
    	width "com2:",10
    rem	open  "com2:1200,n,8,1,rs,cs,ds,cd" for output as #1
    rem	open  "com2:1200,n,8,1,rs,cs,ds,cd" for append as #1
    rem	open  "com2:1200,n,8,1,rs,cs,ds,cd" for random as #1
    	open  "com2:1200,n,8,1" for output as #1
            width "com2:",10
    
            delay 1
            print #1,"atz"
            delay 5
    '-----------
    	for x = 1 to len(a$)
    	print #1,mid$(a$,x,1);
    rem	print #1,mid$(a$,x,1)
    	next x
    
    rem	print #1,a$;
    rem	print #1,a$
    '-----------
            do until inkey$ <> ""
    
            if not eof(1) then
            t$ = input$(1,#1)
            print;t$;using$("### ",asc(t$));
            end if
    
            loop
            close #1
            end
    Tried every possible combination. The un-rem'd lines that didn't
    error out did not produce the desired results. i.e., no Cr's
    every 10th character.

    What are we missing?


    ------------------


    [This message has been edited by Mel Bishop (edited September 11, 2003).]

    Leave a comment:


  • Tom Hanlin
    replied
    WIDTH works on "a device opened for output". Your OPEN is for RANDOM access.


    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Aldo Cavini
    replied
    Mel,

    I tried also what you suggested. Nothing changed - no CRs added. Is it possible it depends on the BIOS or the OS?

    ------------------

    Leave a comment:


  • Mel Bishop
    replied
    Okay. Sorry you saw my original post. It was knee jerk which
    shouldn't have happened.

    I haven't tried this but you may want to:

    width "com1:",10
    open "com1:.....

    i.e., set the width then open the port.
    ------------------


    [This message has been edited by Mel Bishop (edited September 11, 2003).]

    Leave a comment:


  • Aldo Cavini
    replied
    mel, i first replied too fast...

    the reason i open the port, close and repoen is because it is not clear if the width statement works after the port has opened. from the printed manual:
    if the device has already been opened, its width setting is not changed...
    the trick to open, close and reopen is derived from the sample by matthias kuhn, at http://www.powerbasic.com/support/pb...read.php?t=789

    aldo

    ------------------

    [this message has been edited by aldo cavini (edited september 11, 2003).]

    Leave a comment:


  • Mel Bishop
    replied
    Don't think my original response was accurate.


    [This message has been edited by Mel Bishop (edited September 11, 2003).]

    Leave a comment:


  • Aldo Cavini
    started a topic Comm and Width

    Comm and Width

    I have some communication problems (may be I'll post something later...). I started considering the WIDTH statement, and found I don't understand it!

    My communication problem is on a device which doesn't need CRs or LFs to be automatically inserted at all. I never used a statement like WIDTH "COM1:", 255 to disable the automatic CR insertion, as I never suspected it was needed.

    This moment I'm trying the WIDTH statement. I connected toghether the TX and RX lines and run the following code:
    Code:
    open "com1:4800,n,8,1,cs,rs,ds,cd" as #1
    width "com1:", 10
    close #1
    open "com1:4800,n,8,1,cs,rs,ds,cd" as #1
    width "com1:", 10
     
    do while inkey$ = ""
     
      print #1, "123456789012345678901234567890";
      t = timer
      do while timer - t < 1
        if loc( 1 ) then
          print asc( input$( 1, 1 ) );
        end if
      loop
      print
    loop
    The result is every second I back receive the 30 chars I print, but I never see the CR chars I expected. I tried also to simply open the COMM port without WIDTH statements: I expected to see a CR every 80 Tx chars, but it doesn't happen.

    The question is: is WIDTH needed to avoid the CRs insertion on printing to a communication port?

    Aldo


    ------------------
Working...
X
😀
🥰
🤢
😎
😡
👍
👎