CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Continuously data to RS232

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
blackrider



Joined: 13 Apr 2009
Posts: 3

View user's profile Send private message

Continuously data to RS232
PostPosted: Mon Apr 13, 2009 10:48 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 13, 2009 11:06 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

ANSI Control codes for Hyperterminal
PostPosted: Mon Apr 13, 2009 11:45 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 13, 2009 1:51 pm     Reply with quote

@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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Apr 13, 2009 2:51 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Apr 14, 2009 7:53 am     Reply with quote

@jgschmidt: Thank you very much! I did it. Smile
catacomsa



Joined: 29 Oct 2009
Posts: 3

View user's profile Send private message

PostPosted: Mon May 31, 2010 12:36 pm     Reply with quote

@jgschmidt: Thank you very much! I also used this.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group