View previous topic :: View next topic |
Author |
Message |
blackrider
Joined: 13 Apr 2009 Posts: 3
|
Continuously data to RS232 |
Posted: Mon Apr 13, 2009 10:48 am |
|
|
Hello!
I'm using a pic to measure temperature with 2 sensors.
This is the part from code Code: | #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
printf("Sensor1[*C]: %lu \r",temperature1);
printf("Sensor2[*C]: %lu \r",temperature2);
delay_ms(75);
|
and I receive on my Hyperterminal row by row, but I want like a refreshing data, not a spam of statistics.
There is a function or something for this? Thank you in advance and I'm sorry for my poor English. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Apr 13, 2009 11:06 am |
|
|
I don't see the question related to PIC programming.
If I understand right, you are asking for a way to perform cursor positioning in a terminal (Hyperterminal) window. A very basic method is by formfeed <CTRL>L (0xC), usage of a particular terminal emulation as VT100 would provide a more sophisticated display control. |
|
|
jgschmidt
Joined: 03 Dec 2008 Posts: 184 Location: Gresham, OR USA
|
ANSI Control codes for Hyperterminal |
Posted: Mon Apr 13, 2009 11:45 am |
|
|
Physical and software terminals usually can be controlled with Escape Codes to set colors and cursor positions. For ANSI escape codes, these start with the Escape character ascii 27 or 0x1B followed by a left square bracket. Then add in the commands.
This may help...
http://www.pbpgroup.com/modules/wfsection/article.php?articleid=9
Do a search for "hyperteminal escape codes" for more.
Some basics are here:
<esc>"[A" = cursor up
<esc>"[B" = cursor down
<esc>"[C" = cursor right
<esc>"[D" = cursor left
<esc>"[H" = home cursor
<esc>"[J" = clear from cursor to end of screen
<esc><"["><"YY"><";"><"XX"><"f"> = goto y,x
Jurgen |
|
|
blackrider
Joined: 13 Apr 2009 Posts: 3
|
|
Posted: Mon Apr 13, 2009 1:51 pm |
|
|
@FvM: The question was related to PIC programming, for a part from program for PIC18F2620. Now I hope you understood that was PIC related.
I asked how can I manage to make just a pair of data on VT100 with the
changing data. Instead of this case from this picture
I need just a pair of data.(but still in updating process)
@jgschmidt: could you explain please how can I make for C source? |
|
|
jgschmidt
Joined: 03 Dec 2008 Posts: 184 Location: Gresham, OR USA
|
|
Posted: Mon Apr 13, 2009 2:51 pm |
|
|
Try this:
Code: | printf("%c[2JHello.",0x1B);
printf("%c[4;20fInside Temperature: %c[34;43m 72F %c[0m",0x1B,0x1B,0x1B);
printf("%c[6;20fOutside Temperature: %c[34;47m 82F %c[0m",0x1B,0x1B,0x1B);
|
The first line clears the screen, homes the cursor and prints "Hello."
The next two lines each go to a specific row and column and print the label. Then the foreground and background colour are set and the temperature is printed. Finally, the colours are reset to white on black.
I found a source for all the ANSI escape codes here:
http://ascii-table.com/ansi-escape-sequences.php
Just put the two temperature lines in your loop and you should be good to go. I have a similar program that also prints the time at a certain spot on the screen.
These codes can also be used to build non-scrolling menu systems. |
|
|
blackrider
Joined: 13 Apr 2009 Posts: 3
|
|
Posted: Tue Apr 14, 2009 7:53 am |
|
|
@jgschmidt: Thank you very much! I did it. |
|
|
catacomsa
Joined: 29 Oct 2009 Posts: 3
|
|
Posted: Mon May 31, 2010 12:36 pm |
|
|
@jgschmidt: Thank you very much! I also used this. |
|
|
|