Loading ...
Sorry, an error occurred while loading the content.

RE: [libertybasic] Opening serial port

Expand Messages
  • Jim Hiley
    Fred, Your method should work OK. This is what I use: [configuration] commDat$= :19200,n,8,1,ds0 comport$= com7 you can create this string by any
    Message 1 of 3 , Jul 21, 2013
    • 0 Attachment
      Fred,
      Your method should work OK.

      This is what I use:

      [configuration]
      commDat$=":19200,n,8,1,ds0"
      comport$="com7" ' you can create this string by any convenient means


      [openComRoutine]
      oncomerror [handleComError] ' having a routine to handle an incorrect com
      'port is a good idea.
      comspec$=comport$+commDat$
      open comspec$ for random as #MM
      'etc

      You could try each com port in turn until it opens without error but the
      command line method is quicker.

      Jim VK7JH

      -----Original Message-----
      From: libertybasic@yahoogroups.com [mailto:libertybasic@yahoogroups.com] On
      Behalf Of Fred Jensen
      Sent: Monday, 22 July 2013 08:47
      To: libertybasic@yahoogroups.com
      Subject: [libertybasic] Opening serial port

      I need to start LB with a command line argument indicating the specific
      COM port to be used. I know how to get the command line argument from
      CommandLine$.

      My system works fine with the line:

      open "COM4:9600,N,8,1,CS0,RS,DS0" for random as #PORT

      but only on the computer that installs the USB-serial adapter as COM4.
      The other machines pick their own COM#'s. Can I use the number from
      CommandLine$ to build a string variable and then open that string
      variable such as:

      com$="COM"+word$(CommandLine$, 1)+":9600,N,8,1,CS0,RS,DS0"
      open com$ for random as #PORT

      Best Regards,

      Fred K6DGW
      Auburn CA USA
    Your message has been successfully submitted and would be delivered to recipients shortly.