<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>ColdFire/68K Microcontrollers and ProcessorsのトピックRe: Terminal text menu code example?</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Terminal-text-menu-code-example/m-p/213978#M10686</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to follow this one up, we have a terminal system up and working now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A few wrinkles were that there's more than one level of control in a telnet/terminal window; there are escape codes, but there are also telnet negotiation commands which are sent as 0xFF, &amp;lt;something&amp;gt;, where the byte FF is referred to as "Interpret As Command" and tell the terminal things abou whether to send/not send each charater as it's typed, whether to echo locally or not, etc., which makes a difference when navigating with cursor keys or trying to communicate over a link with no inbuilt flow control.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Aug 2012 18:05:19 GMT</pubDate>
    <dc:creator>FridgeFreezer</dc:creator>
    <dc:date>2012-08-10T18:05:19Z</dc:date>
    <item>
      <title>Terminal text menu code example?</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Terminal-text-menu-code-example/m-p/213975#M10683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Background: Our project has a text-based menu which is displayed on a screen and navigated by using a joystick (up, down, left, right) to configure settings etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A hardware change may remove the screen from the project, so as an alternative we're looking at sending the same menu out over the serial port to allow user control via a terminal program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, the communications part is done (we can send &amp;amp; recieve data), and the menu structure and navigation is there (we can traverse a menu structure &amp;amp; modify variables) but the issue is correctly controlling the terminal output to re-write the screen / move the cursor (however it's easiest to make it work) rather than spit out multiple pages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have this menu output on the serial port:&lt;/P&gt;&lt;PRE&gt;MENU&amp;gt;1 = Login 2 = Setup 3 = Options 4 = Help 5 = Exit&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then maybe press the "down" key or enter "4", the software would have to re-send the text again:&lt;/P&gt;&lt;PRE&gt;MENU 1 = Login 2 = Setup 3 = Options&amp;gt;4 = Help 5 = Exit&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But that means your terminal screen (EG hyperterm) now looks like this:&lt;/P&gt;&lt;PRE&gt;MENU&amp;gt;1 = Login 2 = Setup 3 = Options 4 = Help 5 = Exit4MENU 1 = Login 2 = Setup 3 = Options&amp;gt;4 = Help 5 = Exit&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I've found some stuff on Google about VT100 escape codes etc. but not a lot of source code / examples, it seems to be such a common thing (built into everything Linux etc.) that no-one ever codes it themselves or if they do they don't feel it's worth mentioning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, before I try to roll my own from scratch, does anyone have any VT100 or similar routines/examples?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2012 01:15:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Terminal-text-menu-code-example/m-p/213975#M10683</guid>
      <dc:creator>FridgeFreezer</dc:creator>
      <dc:date>2012-03-08T01:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Terminal text menu code example?</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Terminal-text-menu-code-example/m-p/213976#M10684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd prefer a single command-line menu system with help and completion, but that's just me :smileyhappy:.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt; &amp;nbsp;I've found some stuff on Google about VT100 escape codes etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://en.wikipedia.org/wiki/ANSI_escape_code" rel="nofollow" target="_blank"&gt;http://en.wikipedia.org/wiki/ANSI_escape_code&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;The first standard for &lt;STRONG&gt;ANSI escape sequences&lt;/STRONG&gt; was &lt;A href="http://en.wikipedia.org/wiki/Ecma_International" rel="nofollow" target="_blank" title="Ecma International"&gt;ECMA&lt;/A&gt;-48, adopted in 1976. ... The first popular video terminal to support these sequences was the Digital &lt;A href="http://en.wikipedia.org/wiki/VT100" rel="nofollow" target="_blank" title="VT100"&gt;VT100&lt;/A&gt; introduced in 1978,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the ANSI sequences are the "master standard" that you should be searching for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The "where to get sample code" question came up recently in this forum in this post:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.freescale.com/message/106452#106452" title="https://community.freescale.com/message/106452#106452"&gt;https://community.freescale.com/message/106452#106452&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I responded with a pointer to a copy of the "snippets.org" code, and have found thes files, which might be all you need:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www8.cs.umu.se/~isak/snippets/ansiscrn.h" rel="nofollow" target="_blank"&gt;http://www8.cs.umu.se/~isak/snippets/ansiscrn.h&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www8.cs.umu.se/~isak/snippets/ansisys.txt" rel="nofollow" target="_blank"&gt;http://www8.cs.umu.se/~isak/snippets/ansisys.txt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Search around in the directory those are in. There are quite a few matches on "ANSI". There's also "Mark Kimes ANSI screen code interpreter".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You Application may be simple enough to just have "in line ANSII codes" for driving the screen. If you want to write your code to conform to a STANDARD, then you might like to consider curses or ncurses:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://en.wikipedia.org/wiki/Curses_%28programming_library%29" rel="nofollow" target="_blank"&gt;http://en.wikipedia.org/wiki/Curses_%28programming_library%29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could then write the curses library code to "direct address" the on-board screen or generate ANSI sequences for the terminal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another option would be to have your menu program use ANSI codes for everything, and rewrite your display driver to interpret those codes rather than having two different interfaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the "Hex-to-BCD-Conversion" post, "Leong" also suggested the following, which gets a lot of Linux source code hits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.koders.com" rel="nofollow" target="_blank"&gt;http://www.koders.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There may not be anything "simple" there though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2012 08:21:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Terminal-text-menu-code-example/m-p/213976#M10684</guid>
      <dc:creator>TomE</dc:creator>
      <dc:date>2012-03-08T08:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Terminal text menu code example?</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Terminal-text-menu-code-example/m-p/213977#M10685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tom, some good stuff there - and that snippets page is a goldmine of stuff.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2012 20:10:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Terminal-text-menu-code-example/m-p/213977#M10685</guid>
      <dc:creator>FridgeFreezer</dc:creator>
      <dc:date>2012-03-08T20:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Terminal text menu code example?</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Terminal-text-menu-code-example/m-p/213978#M10686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to follow this one up, we have a terminal system up and working now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A few wrinkles were that there's more than one level of control in a telnet/terminal window; there are escape codes, but there are also telnet negotiation commands which are sent as 0xFF, &amp;lt;something&amp;gt;, where the byte FF is referred to as "Interpret As Command" and tell the terminal things abou whether to send/not send each charater as it's typed, whether to echo locally or not, etc., which makes a difference when navigating with cursor keys or trying to communicate over a link with no inbuilt flow control.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 18:05:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Terminal-text-menu-code-example/m-p/213978#M10686</guid>
      <dc:creator>FridgeFreezer</dc:creator>
      <dc:date>2012-08-10T18:05:19Z</dc:date>
    </item>
  </channel>
</rss>

