programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: Serial Terminal IO with commdriver.f

From: Virgil Stamps <vstamps_at_houston.rr.com>
Date: Wed, 21 Dec 2005 13:04:27 -0600

Pedro,
Here is the short commextend file. The SERIAL-PORT BUILDS PORT1 thru PORT4
is something I added for my application.
Virgil
\ commextend.f

SERIAL-PORT REOPEN
   : BAUD ( baud -- )
      GET-COMMSTATE COMMSTATE BaudRate ! SET-COMMSTATE ;
   : @BAUD-RATE ( port -- n) COMMSTATE BaudRate @ ;

   : PARITY ( parity -- ) \ 0-4=no,odd,even,mark,space
      GET-COMMSTATE COMMSTATE Parity C! SET-COMMSTATE ;
   : @PARITY ( port -- n) COMMSTATE Parity C@ ;

   : BYTE-SIZE ( start bits -- ) \ number of bits/byte, 4-8
      GET-COMMSTATE COMMSTATE ByteSize C! SET-COMMSTATE ;
   : @BYTE-SIZE ( port -- n) COMMSTATE ByteSize c@ ;

   : STOP-BITS ( stop bits -- ) \ 0,1,2 = 1, 1.5, 2
      GET-COMMSTATE COMMSTATE StopBits C! SET-COMMSTATE ;
   : @STOP-BITS ( port -- n) COMMSTATE StopBits C@ ;

   : SER-KEY? ( -- flag ) RCV KEY? ;
   : SER-KEY ( -- char ) RCV KEY ;
   : SER-EMIT ( char -- ) XMT EMIT ;
   : SER-TYPE ( addr len -- ) XMT TYPE ;

   : KILL ( -- )
      XMT HTHREAD @ 0 :: TerminateThread DROP
      RCV HTHREAD @ 0 :: TerminateThread DROP CLOSE ;
END-CLASS

\ ie

SERIAL-PORT BUILDS PORT1
SERIAL-PORT BUILDS PORT2
SERIAL-PORT BUILDS PORT3
SERIAL-PORT BUILDS PORT4

-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] On Behalf Of
Pedro Monteiro
Sent: Wednesday, December 21, 2005 10:58 AM
To: sftalk_at_forth.com
Subject: [sftalk] Serial Terminal IO with commdriver.f

Earlier this month there was an SFTalk post that used Commextend.f . Does
anyone have that file? I could not replicate the example, presumably because
I do not have that file.
I'm using SF 2.2.2.9.
Thanks,
Pedro
---------------------------------------------------------------------

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Wed Dec 21 2005 - 11:05:01 PST

This archive was generated by hypermail 2.2.0 : Thu Dec 04 2008 - 03:04:20 PST