PDA

View Full Version : PK2 UART tool



cncmachineguy
- 17th May 2011, 00:23
I am not sure this is really a serial issue, but what the heck here goes.

Is there a way to not have data scroll when using the UART tool? I realize sending the CR causes a line return, this is needed to not just overwrite the same line. What I want is to be able to do something like a home command, then re-write the screen with new values. Does this make sense?

I guess I want a formated screen. I know I can't have this with the UART tool, but it seems like if I can start a new "block" of data at the top left, I will get close.

mackrackit
- 17th May 2011, 09:26
Maybe I am not following what you want, but I think the solution is in the PC side. You need a program that will only display the current/last line of data?

cncmachineguy
- 17th May 2011, 10:15
Let me see if I can do better here. I have 18 words of data. I want to display the first word on the top line in the window, second value on the second line, so forth and so on down to the 18th value on the 18th line.

Then I want to start back at the top when the new data set is transmitted. So first value on the first line, second on the second line, down to the bottom.

The way it works for me now, is once the screen fills, it just scrolls, so I am just seeing data roll on by. I can stop(disconnect) then look back but of course the data has less value to me then.

I looked through an ASCII chart, I don't think there is a control character for "home" or "clearscreen". After all how would that have been used back in the teletype days?

ScaleRobotics
- 17th May 2011, 10:27
I have not tried it, but you might try chr$(26)

<table style="margin-left: 3em;"><tbody><tr><td><code>CHR$(4)</code></td><td>DOS command escape prefix </td></tr><tr><td><code>CHR$(7)</code></td><td>Make a "beep" (if your browser supports it) </td></tr><tr><td><code>CHR$(8)</code></td><td>Backspace (move cursor left, wrap up) </td></tr><tr><td><code>CHR$(10)</code></td><td>Line feed (move cursor down) </td></tr><tr><td><code>CHR$(13)</code></td><td>Carriage return (move cursor down and to left edge) </td></tr><tr><td><code>CHR$(127)</code></td><td>Displays a cursor glyph </td></tr></tbody></table> <table style="margin-left: 3em;"><tbody><tr><td><code>CHR$(11)</code></td><td>Clears from the cursor position to the end of the window </td></tr><tr><td><code>CHR$(12)</code></td><td>Move cursor to upper left and clear window </td></tr><tr><td><code>CHR$(14)</code></td><td>Set normal text output </td></tr><tr><td><code>CHR$(15)</code></td><td>Set inverse text output </td></tr><tr><td><code>CHR$(17)</code></td><td>Set display to 40 columns </td></tr><tr><td><code>CHR$(18)</code></td><td>Set display to 80 columns </td></tr><tr><td><code>CHR$(21)</code></td><td>Deactivate the 80-column firmware </td></tr><tr><td><code>CHR$(22)</code></td><td>Scroll display down, preserving cursor position </td></tr><tr><td><code>CHR$(23)</code></td><td>Scroll display up, preserving cursor position </td></tr><tr><td><code>CHR$(24)</code></td><td>Disable mousetext </td></tr><tr><td><code>CHR$(25)</code></td><td>Move cursor to upper left (but don't clear window) </td></tr><tr><td><code>CHR$(26)</code></td><td>Clear the current line </td></tr><tr><td><code>CHR$(27)</code></td><td>Enable mousetext </td></tr><tr><td><code>CHR$(28)</code></td><td>Forward space (move cursor right, wrap down) </td></tr><tr><td><code>CHR$(29)</code></td><td>Clear from cursor position to end of line </td></tr></tbody></table>

cncmachineguy
- 17th May 2011, 10:33
WALTER!!!! Where did this chart come from? Should I have read something related to PK2? (sarcasim aimed at myself)

Looks like I need CHR$(12) or (25)

Time to get ready for work now, but this is first on my fun list for tonight :):)

ScaleRobotics
- 17th May 2011, 10:41
Scratch that. That's applesoft, I see it varies greatly from the official ascii control character reference. Don't think that will work. But here's my reference: http://www.calormen.com/applesoft/reference.htm

Yeah, maybe you could do something with form feed chr$(12)...

Here's a list that is more complete than the manual, but alas, I do not see a clear.

Ascii control codes (control characters, C0 controls)

The following document lists the control codes (http://www.cs.tut.fi/%7Ejkorpela/chars.html#control) (control characters) in Ascii (http://www.cs.tut.fi/%7Ejkorpela/chars.html#ascii) and in newer character code standards like Unicode, which generally try to be compatible with Ascii in the Ascii code range (positions 0 through 127).
<table border="1" cellpadding="3" cellspacing="0"> <thead> <tr><th>
</th><th colspan="2">code pos.</th> <th colspan="2">Unicode</th><th rowspan="2" valign="top">Description in <cite>C0 of ISO 646</cite></th> </tr><tr><th>
</th><th>dec.</th> <th>hex.</th> <th>abbr.</th> <th>name</th> </tr></thead><thead> </thead><tbody> <tr><td>
</td><td align="right">0</td><td align="right">0</td><td>NUL</td><td>NULL</td> <td>A control character used to accomplish media-fill or time-fill. Null characters may be inserted into or removed from a stream of data without affecting the information content of that stream. But then the addition or removal of these characters may affect the information layout and/or the control of equipment.</td> </tr><tr><td nowrap="nowrap">ctl-A</td><td align="right">1</td><td align="right">1</td><td>SOH</td><td>START OF HEADING</td> <td>A transmission control character used as the first character of a heading of an information message. </td> </tr><tr><td nowrap="nowrap">ctl-B</td><td align="right">2</td><td align="right">2</td><td>STX</td><td>START OF TEXT</td> <td>A transmission control character which precedes a text and which is used to terminate a heading. </td> </tr><tr><td nowrap="nowrap">ctl-C</td><td align="right">3</td><td align="right">3</td><td>ETX</td><td>END OF TEXT</td> <td>A transmission control character which terminates a text.</td> </tr><tr><td nowrap="nowrap">ctl-D</td><td align="right">4</td><td align="right">4</td><td>EOT</td><td>END OF TRANSMISSION</td> <td>A transmission control character used to indicate the conclusion of the transmission of one or more texts..</td> </tr><tr><td nowrap="nowrap">ctl-E</td><td align="right">5</td><td align="right">5</td><td>ENQ</td><td>ENQUIRY</td> <td>A transmission control character used as a request for a response from a remote station; the response may include station identification and/or station status. When a "Who are you" function is required on the general switched transmission network, the first use of ENQ after the connection is established shall have the meaning "Who are you" (station identification). Subsequent use of ENQ may, or may not, include the function "Who are you", as determined by agreement. </td></tr><tr><td nowrap="nowrap">ctl-F</td><td align="right">6</td><td align="right">6</td><td>ACK</td><td>ACKNOWLEDGE</td> <td>A transmission control character transmitted by a receiver as an affirmative response to the sender.</td> </tr><tr><td nowrap="nowrap">ctl-G</td><td align="right">7</td><td align="right">7</td><td>BEL</td><td>BELL</td> <td>A control character that is used when there is a need to call for attention; it may control alarm or attention devices.</td> </tr><tr><td nowrap="nowrap">ctl-H</td><td align="right">8</td><td align="right">8</td><td>BS</td><td>BACKSPACE</td> <td>A format effector which moves the active position one character position backwards on the same line.</td> </tr><tr><td nowrap="nowrap">ctl-I</td><td align="right">9</td><td align="right">9</td><td>HT</td><td>HORIZONTAL TABULATION</td> <td>A format effector which advances the active position to the next pre-determined character position on the same line.</td> </tr><tr><td nowrap="nowrap">ctl-J</td><td align="right">10</td><td align="right">A</td><td>LF</td><td>LINE FEED</td> <td>A format effector which advances the active position to the same character position of the next line.</td> </tr><tr><td nowrap="nowrap">ctl-K</td><td align="right">11</td><td align="right">B</td><td>VT</td><td>VERTICAL TABULATION</td> <td>A format effector which advances the active position to the same character position on the next pre-determined line.</td> </tr><tr><td nowrap="nowrap">ctl-L</td><td align="right">12</td><td align="right">C</td><td>FF</td><td>FORM FEED</td> <td>A format effector which advances the active position to the same character position on a pre-determined line of the next form or page.</td> </tr><tr><td nowrap="nowrap">ctl-M</td><td align="right">13</td><td align="right">D</td><td>CR</td><td>CARRIAGE RETURN</td> <td>A format effector which moves the active position to the first character position on the same line.</td> </tr><tr><td nowrap="nowrap">ctl-N</td><td align="right">14</td><td align="right">E</td><td>SO</td><td>SHIFT OUT</td> <td>A control character which is used in conjunction with SHIFT IN and ESCAPE to extend the graphic character set of the code. It may alter the meaning of octets 33 - 126 (dec.). The effect of this character when using code extension techniques is described in International Standard ISO 2022. </td> </tr><tr><td nowrap="nowrap">ctl-O</td><td align="right">15</td><td align="right">F</td><td>SI</td><td>SHIFT IN</td> <td>A control character which is used in conjunction with SHIFT OUT and ESCAPE to extend the graphic character set of the code. It may reinstate the standard meanings of the octets which follow it. The effect of this character when using code extension techniques is described in International Standard ISO 2022. </td> </tr><tr><td nowrap="nowrap">ctl-P</td><td align="right">16</td><td align="right">10</td><td>DLE</td><td>DATA LINK ESCAPE</td> <td>A transmission control character which will change the meaning of a limited number of contiguously following characters. Its is used exclusively to provide supplementary data transmission control functions. Only graphic characters and transmission control characters can be used in DLE sequences.</td> </tr><tr><td nowrap="nowrap">ctl-Q</td><td align="right">17</td><td align="right">11</td><td>DC1</td><td>DEVICE CONTROL ONE</td> <td>A device control character which is primarily intended for turning on or starting an ancillary device. If it is not required for this purpose, it may be used to restore a device to the basic mode of operation (see also DC2 and DC3), or for any other device control function not provided by other DCs. </td> </tr><tr><td nowrap="nowrap">ctl-R</td><td align="right">18</td><td align="right">12</td><td>DC2</td><td>DEVICE CONTROL TWO</td> <td>A device control character which is primarily intended for turning on or starting an ancillary device. If it is not required for this purpose, it may be used to set a device to a special mode of operation (in which case DC1 is used to restore normal operation), or for any other device control function not provided by other DCs. </td> </tr><tr><td nowrap="nowrap">ctl-S</td><td align="right">19</td><td align="right">13</td><td>DC3</td><td>DEVICE CONTROL THREE</td> <td>A device control character which is primarily intended for turning off or stopping an ancillary device. This function may be a secondary level stop, for example, wait, pause, stand-by or halt (in which case DC1 is used to restore normal operation). If it is not required for this purpose, it may be used for any other device control function not provided by other DCs. </td></tr><tr><td nowrap="nowrap">ctl-T</td><td align="right">20</td><td align="right">14</td><td>DC4</td><td>DEVICE CONTROL FOUR</td> <td>A device control character which is primarily intended for turning off, stopping or interrupting an ancillary device. If it is not required for this purpose, it may be used for any other device control function not provided by other DCs. </td></tr><tr><td nowrap="nowrap">ctl-U</td><td align="right">21</td><td align="right">15</td><td>NAK</td><td>NEGATIVE ACKNOWLEDGE</td> <td>A transmission control character transmitted by a receiver as a negative response to the sender.</td> </tr><tr><td nowrap="nowrap">ctl-V</td><td align="right">22</td><td align="right">16</td><td>SYN</td><td>SYNCHRONOUS IDLE</td> <td>A transmission control character used by a synchronous transmission system in the absence of any other character (idle condition) to provide a signal from which synchronism may be achieved or retained between data terminal equipment. </td></tr><tr><td nowrap="nowrap">ctl-W</td><td align="right">23</td><td align="right">17</td><td>ETB</td><td>END OF TRANSMISSION BLOCK</td> <td>A transmission control character used to indicate the end of a transmission block of data where data is divided into such blocks for transmission purposes.</td> </tr><tr><td nowrap="nowrap">ctl-X</td><td align="right">24</td><td align="right">18</td><td>CAN</td><td>CANCEL</td> <td>A character, or the first character of a sequence, indicating that the data preceding it is in error. As a result, this data is to be ignored. The specific meaning of this character must be defined for each application and/or between sender and recipient. </td> </tr><tr><td nowrap="nowrap">ctl-Y</td><td align="right">25</td><td align="right">19</td><td>EM</td><td>END OF MEDIUM</td> <td>A control character that may be used to identify the physical end of a medium, or the end of the used portion of a medium, or the end of the wanted portion of data recorded on a medium. The position of this character does not necessarily correspond to the physical end of the medium.</td> </tr><tr><td nowrap="nowrap">ctl-Z</td><td align="right">26</td><td align="right">1A</td><td>SUB</td><td>SUBSTITUTE</td> <td>A control character used in the place of a character that has been found to be invalid or in error. SUB is intended to be introduced by automatic means. </td></tr><tr><td nowrap="nowrap">ctl-[</td><td align="right">27</td><td align="right">1B</td><td>ESC</td><td>ESCAPE</td> <td>A control character which is used to provide additional control functions. It alters the meaning of a limited number of contiguously following bit combinations. The use of this character is specified in International Standard ISO 2022. </td></tr><tr><td nowrap="nowrap">ctl-\</td><td align="right">28</td><td align="right">1C</td><td>FS</td><td>FILE SEPARATOR</td> <td>A control character used to separate and qualify data logically; its specific meaning has to be specified for each application. If this character is used in hierarchical order, it delimits a data item called a file. </td></tr><tr><td nowrap="nowrap">ctl-]</td><td align="right">29</td><td align="right">1D</td><td>GS</td><td>GROUP SEPARATOR</td> <td>A control character used to separate and qualify data logically; its specific meaning has to be specified for each application. If this character is used in hierarchical order, it delimits a data item called a group. </td></tr><tr><td nowrap="nowrap">ctl-^</td><td align="right">30</td><td align="right">1E</td><td>RS</td><td>RECORD SEPARATOR</td> <td>A control character used to separate and qualify data logically; its specific meaning has to be specified for each application. If this character is used in hierarchical order, it delimits a data item called a record. </td></tr><tr><td nowrap="nowrap">ctl-_</td><td align="right">31</td><td align="right">1F</td><td>US</td><td>UNIT SEPARATOR</td> <td>A control character used to separate and qualify data logically; its specific meaning has to be specified for each application. If this character is used in hierarchical order, it delimits a data item called a unit. </td></tr><tr><td>
</td><td align="right">127</td><td align="right">7F</td><td>DEL</td><td>DELETE</td><td><small>(not defined)</small></td> </tr></tbody> </table>

cncmachineguy
- 17th May 2011, 13:06
Follow up, after googling for a while, I ended up back on PBP forum reading a thread started by Hank. The gist concerning this thread is UART tool won't do what I want. I need to use a real terminal or custom GUI. Well I don't plan that level of effort for the testing I am doing, So tonight I will try 1 last thing.

If I can fit the data on 1 line, maybe I can send a "header" so to speak as the first line, then the data all out on the next line. When I send new data, I will send the code for backspace to see if I can get to the beginning of the data line and send the new data.

Archangel
- 20th May 2011, 07:35
Hi Bert,
It sounds like you want to receive data and display it line over line in a "console" or dos type environment so it displays as :
DATA WORD 1
DATA WORD 2
DATA WORD 3
DATA WORD 4

. . . is this correct ? Assuming it is then given a typical DOS " MODE" you could see
80 x 40 characters.On screen.
You would likely have to write this program for the PC probably in " C ". Or using VB in a GUI environment. Another option is to write your USART to output HTML and view in a browser . . . HTML could format text to display that way, I THINK.

cncmachineguy
- 20th May 2011, 10:54
Hi Joe, that is mostly correct about how I want to display the data. But I want to overwrite the values with new values, not scroll them as the uart tool does now.

I have no idea how or where to start to get data from a com port to a browser window. Next issue I have no idea how to get data from pk2 to an application. But I have spent time trying to learn both python and liberty basic, so maybe I should try and make an app for displaying the data. Dave (makracket) has an example of python serial on his website. So maybe I could head down that path.

mister_e
- 20th May 2011, 11:06
What you want to do, most, see all, ANSI terminal would do it. Hyperterminal, TeraTerm and so on.

Check this link on Darrel's Website
http://www.pbpgroup.com/modules/wfsection/article.php?articleid=9

You could also hack the PK2 code, it's open source and really well documented.

It's up to you ;)

It's also easy to do in VB or C#, lots of example 'round the web. The Express version are free for non-profit use.

mackrackit
- 20th May 2011, 14:30
Here is some old stuff I was helping some kids with.
Look at the "liberty" code "remote..." if you go the Liberty route.
http://mackrackit.com/mac/www/dave/basic.html

cncmachineguy
- 21st May 2011, 01:46
The weather station looks almost perfect as is. Accepts a stream from com port and puts the data in the boxes.

Archangel
- 24th May 2011, 01:48
I found this if it helps:
http://www.electronic-engineering.ch/microchip/software/rs232debug.html
http://www.electronic-engineering.ch/microchip/index.html

Ioannis
- 24th May 2011, 08:00
If you use the Bray++ Terminal, then simply by setting a Rx Clear character, your Receive window is instantly cleared!

That simple. No coding, no special ANSI codes, no nothing.

Just send from your PIC a character, whatever you do no use normally and off you go!

Download from here:
https://sites.google.com/site/terminalbpp/Terminal20100630.zip?attredirects=0

Ioannis