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

Re: [libertybasic] RS232 in Liberty basic

Expand Messages
  • Stefan Pendl
    ... Did you try to use the baud-rate in the open command? ---code start (watch for line wraps) OPEN com1:2057,n,8,1,RS,CS0,DS0,CD0 FOR RANDOM AS #1 ---code
    Message 1 of 4 , Sep 6, 2013
      Am 06.09.2013 21:29, schrieb Gerhard:
      >
      >
      > dear all,
      >
      > my old multimeter has a rs232 output with a non standard baudrate: 2057 Hz
      >
      > When connected to a pc the routine below works fine with win98 and Ms
      > Quickbasic but does not work in LB 4.03 on win 98.
      >
      > Can LB handle rs232 with this baudrate?
      >
      > 10 OPEN "com1:75,n,8,1,RS,CS0,DS0,CD0" FOR RANDOM AS #1
      > OUT &H3FC, INP(&H3FC) AND &HFF:'SET DTR AND RTS TO "0" (PUT METER IN RX
      > MODE)
      > DIVLO = 56: DIVHI = 0: 'divisor for 2057 Hz
      > OUT &H3FB, INP(&H3FB) OR &H80
      > OUT &H3F8, DIVLO
      > OUT &H3F9, DIVHI
      > OUT &H3FB, INP(&H3FB) AND &H7F
      > PRINT #1, CHR$(0);
      >
      > Can you give me a hint to make this routine acceptable for LB?
      > Your help will be appreciated very much,
      >

      Did you try to use the baud-rate in the open command?

      '---code start (watch for line wraps)

      OPEN "com1:2057,n,8,1,RS,CS0,DS0,CD0" FOR RANDOM AS #1

      '---code end

      --
      Stefan Pendl
      http://stefanpendl.runbasichosting.com/

      LB 4.04 Pro ... http://www.libertybasic.com/assist.html
      LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

      LB Community Wiki .............. http://basic.wikispaces.com/
      LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
      LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

      Books at http://www.lulu.com/ and http://www.amazon.com/
      Alyce Watson ... APIs for Liberty BASIC
      Carl Gundel .... Beginning Programming with Liberty BASIC

      Windows 7 Home Premium 64-bit SP1
      AMD Turion X2 RM-70 2GHz, 4GB RAM
    • g_wensink
      ... Did you try to use the baud-rate in the open command? ---code start (watch for line wraps) OPEN com1:2057,n,8,1,RS,CS0,DS0,CD0 FOR RANDOM AS #1 ---code
      Message 2 of 4 , Sep 7, 2013

         ---

        OPEN "com1:2057,n,8,1,RS,CS0,DS0,CD0" FOR RANDOM AS #1

        ---

        When I apply your suggestion I get indeed some input but this is not correct:

        only the characters 0 and 96 are imported and they do not change when the display changes.





        --- In libertybasic@yahoogroups.com, <libertybasic@yahoogroups.com> wrote:

        Am 06.09.2013 21:29, schrieb Gerhard:
        >
        >
        > dear all,
        >
        > my old multimeter has a rs232 output with a non standard baudrate: 2057 Hz
        >
        > When connected to a pc the routine below works fine with win98 and Ms
        > Quickbasic but does not work in LB 4.03 on win 98.
        >
        > Can LB handle rs232 with this baudrate?
        >
        > 10 OPEN "com1:75,n,8,1,RS,CS0,DS0,CD0" FOR RANDOM AS #1
        > OUT &H3FC, INP(&H3FC) AND &HFF:'SET DTR AND RTS TO "0" (PUT METER IN RX
        > MODE)
        > DIVLO = 56: DIVHI = 0: 'divisor for 2057 Hz
        > OUT &H3FB, INP(&H3FB) OR &H80
        > OUT &H3F8, DIVLO
        > OUT &H3F9, DIVHI
        > OUT &H3FB, INP(&H3FB) AND &H7F
        > PRINT #1, CHR$(0);
        >
        > Can you give me a hint to make this routine acceptable for LB?
        > Your help will be appreciated very much,
        >

        Did you try to use the baud-rate in the open command?

        '---code start (watch for line wraps)

        OPEN "com1:2057,n,8,1,RS,CS0,DS0,CD0" FOR RANDOM AS #1

        '---code end

        --
        Stefan Pendl
        http://stefanpendl.runbasichosting.com/

        LB 4.04 Pro ... http://www.libertybasic.com/assist.html
        LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

        LB Community Wiki .............. http://basic.wikispaces.com/
        LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
        LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

        Books at http://www.lulu.com/ and http://www.amazon.com/
        Alyce Watson ... APIs for Liberty BASIC
        Carl Gundel .... Beginning Programming with Liberty BASIC

        Windows 7 Home Premium 64-bit SP1
        AMD Turion X2 RM-70 2GHz, 4GB RAM
      • Stefan Pendl
        ... Have you used the HEXDEC() function to convert the hexadecimal numbers to decimals as shown below? ---code start (watch for line wraps) OUT &H3FC,
        Message 3 of 4 , Sep 8, 2013
          Am 07.09.2013 22:22, schrieb gerhard47@...:
          >
          >
          > ---
          >
          > OPEN "com1:2057,n,8,1,RS,CS0,DS0,CD0" FOR RANDOM AS #1
          >
          > ---
          >
          > When I apply your suggestion I get indeed some input but this is not
          > correct:
          >
          > only the characters 0 and 96 are imported and they do not change when
          > the display changes.
          >

          Have you used the HEXDEC() function to convert the hexadecimal numbers
          to decimals as shown below?

          '---code start (watch for line wraps)

          ' OUT &H3FC, INP(&H3FC) AND &HFF

          OUT hexdec("&H3FC"), INP(hexdec("&H3FC")) AND hexdec("&HFF")

          '---code end

          --
          Stefan Pendl
          http://stefanpendl.runbasichosting.com/

          LB 4.04 Pro ... http://www.libertybasic.com/assist.html
          LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

          LB Community Wiki .............. http://basic.wikispaces.com/
          LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
          LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

          Books at http://www.lulu.com/ and http://www.amazon.com/
          Alyce Watson ... APIs for Liberty BASIC
          Carl Gundel .... Beginning Programming with Liberty BASIC

          Windows 7 Home Premium 64-bit SP1
          AMD Turion X2 RM-70 2GHz, 4GB RAM
        Your message has been successfully submitted and would be delivered to recipients shortly.