Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Terminal Emulator App
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ian Bell  
View profile  
 More options Dec 21 2004, 1:10 pm
Newsgroups: comp.lang.tcl
From: Ian Bell <ruffreco...@yahoo.com>
Date: Tue, 21 Dec 2004 18:10:12 +0000
Local: Tues, Dec 21 2004 1:10 pm
Subject: Terminal Emulator App
I am writing a terminal emulator in tcl/tk which communicates via a serial
link with a microcontroller development board.  it is unusual because of
the microcontroller monitor programme comtrolling the other end of the
serial link. When the terminal sends a character, the monitor expects the
terminal to *wait* until the monitor has echoed the character before
sending another. The monitor may also send streams of data to the terminal.
The logic of this is not hard to deal with but it would be simplest if I
had an event triggered whenever a character is received.  A simple flag set
by sending a char would allow the event handler to differentiate between
and echoed character and one in a stream.  The problem is I don't know how
to set up the event.  Read does not do what I want AFAICS.

Any help appreciated.

Ian
--
Ian Bell


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Nelson  
View profile  
 More options Dec 21 2004, 3:15 pm
Newsgroups: comp.lang.tcl
From: "Christopher Nelson" <cnel...@nycap.rr.com>
Date: 21 Dec 2004 12:15:27 -0800
Local: Tues, Dec 21 2004 3:15 pm
Subject: Re: Terminal Emulator App

Ian Bell wrote:
> ...
> The logic of this is not hard to deal with but it would be simplest
if I
> had an event triggered whenever a character is received.  ...

Can you use a combination of [fileevent]
(http://aspn.activestate.com/ASPN/docs/ActiveTcl/tcl/TclCmd/fileevent.htm)
and [event generate]
(http://aspn.activestate.com/ASPN/docs/ActiveTcl/tcl/TkCmd/event.htm#M7)
with some virtual event to do what you need?
.
.                                          Chris

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Quokka  
View profile  
 More options Dec 21 2004, 7:27 pm
Newsgroups: comp.lang.tcl
From: Quokka <NoS...@iinet.net.au>
Date: Wed, 22 Dec 2004 08:27:27 +0800
Local: Tues, Dec 21 2004 7:27 pm
Subject: Re: Terminal Emulator App

Christopher Nelson wrote:
> Ian Bell wrote:

>>...
>>The logic of this is not hard to deal with but it would be simplest

> if I

>>had an event triggered whenever a character is received.  ...

Maybe the following wiki pages may help

http://wiki.tcl.tk/3213
http://wiki.tcl.tk/3642

Paul


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Melissa Schrumpf  
View profile  
 More options Dec 21 2004, 8:10 pm
Newsgroups: comp.lang.tcl
From: Melissa Schrumpf <m_schrumpf_at_yahoo_com_...@microsoft.com>
Date: Tue, 21 Dec 2004 20:10:53 -0500
Local: Tues, Dec 21 2004 8:10 pm
Subject: Re: Terminal Emulator App

Ian Bell wrote:
> I am writing a terminal emulator in tcl/tk which communicates via a serial
> link with a microcontroller development board.  it is unusual because of
> the microcontroller monitor programme comtrolling the other end of the
> serial link. When the terminal sends a character, the monitor expects the
> terminal to *wait* until the monitor has echoed the character before
> sending another. The monitor may also send streams of data to the terminal.
> The logic of this is not hard to deal with but it would be simplest if I
> had an event triggered whenever a character is received.  A simple flag set
> by sending a char would allow the event handler to differentiate between
> and echoed character and one in a stream.  The problem is I don't know how
> to set up the event.  Read does not do what I want AFAICS.
> Any help appreciated.

This is not very unusual at all.  Basically, you've defined the
microcontroller as the master in the network protocol, most likely
because it's resources are limited, and you use the echo feature to
prevent overloading it with interrupts, but the computer is presumed to
be able to handle receipt and buffering of streaming data, right?

Here's a loose description of how it could be done, sprinkled with
example code from one of my serial device comms programs, and some more
mocked up:

set wait_echo 0
set echo_char ""

proc opencomm {} {
   global cid
   set cid [open COM1: RDWR]
   fconfigure $cid -blocking 0 -mode 38400,n,8,1 -translation binary
   fileevent $cid readable rxchar

}

proc closecomm {} {
   global cid
   fileevent $cid readable {}
   close $cid

}

proc rxchar {} {

global cid wait_echo echo_char
   set c [read $cid 1]
   #binary scan $c H* hval

   if {$wait_echo} {
      if {$echo_char!=$c} {
         # handle echo error
      }
   } else {
      # do something, like appending the streaming data
      # into another global, and evaluate the contents of
      # that buffer, e.g. for message completeness, checksum,
      # etc.
   }

   if {[eof $cid]} {
      # handle a suddenly-closed com port
   }

}

proc txchar {c} {
   global cid wait_echo echo_char
   if {[catch {puts -nonewline $cid $c} res]} {
      # couldn't write to serial
      # handle the error here, perhaps by:
      # catch {closecomm}; opencomm
   }
   set echo_char $c
   set wait_echo 1

}

Is that about what you're looking for?

--
MKS


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Bell  
View profile  
 More options Dec 22 2004, 2:01 pm
Newsgroups: comp.lang.tcl
From: Ian Bell <ruffreco...@yahoo.com>
Date: Wed, 22 Dec 2004 19:01:14 +0000
Local: Wed, Dec 22 2004 2:01 pm
Subject: Re: Terminal Emulator App

Quokka wrote:
> Christopher Nelson wrote:
>> Ian Bell wrote:

>>>...
>>>The logic of this is not hard to deal with but it would be simplest

>> if I

>>>had an event triggered whenever a character is received.  ...

> Maybe the following wiki pages may help

Many thanks, they did indeed help

Wow, that is elegant code

Excellent stuff.  Most of what I need.

Cheers

Ian
--
Ian Bell


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Bell  
View profile  
 More options Dec 22 2004, 2:09 pm
Newsgroups: comp.lang.tcl
From: Ian Bell <ruffreco...@yahoo.com>
Date: Wed, 22 Dec 2004 19:09:17 +0000
Local: Wed, Dec 22 2004 2:09 pm
Subject: Re: Terminal Emulator App

Pretty much spot on.  The monitor prog is given by the manufacturer of the
microcontroller development board so in that sense We are forced to
consider it as master.

> Here's a loose description of how it could be done, sprinkled with
> example code from one of my serial device comms programs, and some more
> mocked up:

Thanks for the code.  Just the thing.

--
Ian Bell


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Bell  
View profile  
 More options Dec 29 2004, 11:08 am
Newsgroups: comp.lang.tcl
From: Ian Bell <ruffreco...@yahoo.com>
Date: Wed, 29 Dec 2004 16:08:39 +0000
Local: Wed, Dec 29 2004 11:08 am
Subject: Re: Terminal Emulator App
Just a quick note of thanks to all who helped me with my rather specialised
terminal application for use with an 8051 single board computer.  It is up
an running now thanks to help from the members of this group.  If anyone is
interested you can find a link to the code on this page:

http://www.8052.com/users/redtommo

Cheers

Ian

--
Ian Bell


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google