locked
how to program the interaction with COM-port by Small Basic RRS feed

  • Question

  • Please give me the fresh quote with samples how to program the interaction with COM-port by Small Basic without C++
    Friday, March 1, 2013 9:17 AM

Answers

  • PLZ see this thread .

      

    http://social.msdn.microsoft.com/Forums/pl-PL/smallbasic/thread/a386d352-f7e3-4fb7-93e5-5eaf029c5fd9

    CommPort.OpenPort("COM1",9600) ' Comport Number=1  baud rate= 9600

    Comm_Enter()

    Sub Comm_Enter    
    deli10=Text.GetCharacter(10) ' Line feed
    deli13=Text.GetCharacter(13) ' Carriage return
    deli= deli13+deli10 
      MSG="XXXX"+deli           'XXXX maybe initialize command or other command
    Commport.TXString(MSG)    'Sends message

    MSG="YYYY"+deli           'YYYY maybe data receive command
    CommPort.TXString(MSG)
    Dat=""
         Loop:
          Dat1=CommPort.RXChar()     'Receives data as 1 byte . One by one.
           If Dat1=deli10 then
             Goto End1
           EndIf
          Dat=text.Append(Dat,Dat1)  'Connects data
       Goto Loop   
        End1:
        Dat=math.ABS(Math.Floor(Dat)) 'absolute , half-adjusted data
       TextWindow.WriteLine(Dat)
     Endsub

    * and See  Nino's  program IDNo   SNL137
    Saturday, March 2, 2013 1:23 AM
    Answerer

All replies

  • Hi Nicholas,

    You cannot communicate with COM-Ports without any extension. There are several extensions available that provide way to communicate with ports.

    List of Small Basic Extensions << Download from here.


    Merry Xmas!

    Friday, March 1, 2013 10:13 AM
  • Hi, 4mir,
    Thank you, but still have some doubt about whether the C++ will be need or after the installing of extention it will be possible to program without C++?  

    Friday, March 1, 2013 3:40 PM
  • This thread has sample Small Basic serial port program.
    http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/b9f7dc00-36e6-441f-b14a-24bbe8a49328

    Nonki Takahashi

    • Proposed as answer by litdev Friday, March 1, 2013 8:19 PM
    Friday, March 1, 2013 4:18 PM
  • PLZ see this thread .

      

    http://social.msdn.microsoft.com/Forums/pl-PL/smallbasic/thread/a386d352-f7e3-4fb7-93e5-5eaf029c5fd9

    CommPort.OpenPort("COM1",9600) ' Comport Number=1  baud rate= 9600

    Comm_Enter()

    Sub Comm_Enter    
    deli10=Text.GetCharacter(10) ' Line feed
    deli13=Text.GetCharacter(13) ' Carriage return
    deli= deli13+deli10 
      MSG="XXXX"+deli           'XXXX maybe initialize command or other command
    Commport.TXString(MSG)    'Sends message

    MSG="YYYY"+deli           'YYYY maybe data receive command
    CommPort.TXString(MSG)
    Dat=""
         Loop:
          Dat1=CommPort.RXChar()     'Receives data as 1 byte . One by one.
           If Dat1=deli10 then
             Goto End1
           EndIf
          Dat=text.Append(Dat,Dat1)  'Connects data
       Goto Loop   
        End1:
        Dat=math.ABS(Math.Floor(Dat)) 'absolute , half-adjusted data
       TextWindow.WriteLine(Dat)
     Endsub

    * and See  Nino's  program IDNo   SNL137
    Saturday, March 2, 2013 1:23 AM
    Answerer