Teraterm values flickering and difficult to read.

04 Dec 2012

Hi all, I've been asking a few questions on here but i have one i'm sure many will know how to solve. I have a simple program which puts a value obtained into teraterm. The problem is the cycle of reading it, putting it on the screen in teraterm, and then refreshing causes it to 'flicker' and any changes in the values are difficult to see. The device is working in real time so the values are updating as quickly as the microprocessor can do it. I was wondering if someone could tell me how to get the values showing on the screen nice and cleanly and solid.

I've attached the progam to look at.

Many Thanks Rob

/media/uploads/robert111/aaapiezo_test_1_lpc11u24.bin

04 Dec 2012

Your first version with the code was handier, just check the editting tips for correct syntax so the code would work. But just a bin file is less useful imo, especially since the majority here doesnt have the 11u24 ;)

04 Dec 2012

I tried to copy it in but it seemed to change it all and cut some out.I'll copy it in again. Cheers

<<CODE>>

#include "mbed.h"
#include "Terminal.h"                           //header file for terminal screen

Terminal term(USBTX, USBRX);                    //setup USB interface to host terminal
AnalogIn mypot(p20);                            //Assign mypot to analog input on pin20

float array1[100];
float x, y;
float sum;
int q, r;
  
int main() 
{

    while(1) 
    {
    
    x=mypot.read();                 //reads value of pot
    
    //**************Raw value section of program to show value is correct*****************
    
    //term.printf(" Raw Value = %f0.2\n   ",x*3.3);
    
    
    //Add together 10 values from piezo sensor
    for ( q=0; q<99; q++);
    {
    array1[q]=x;
    //wait(0.1);
    }
    
    sum=0;                                               
            for (r=0;r<=99;r++)                                
            {
            sum = sum+array1[r];
            }
            
    sum=sum/100;        
    y=sum*3.3;
    x=x*100;
    term.printf(" Raw Value = %f0.2     Value 1 = %f0.2\r  ",x,y);       //print value on teraterm
        
    //wait (0.2);                     //wait 0.2 seconds between samples
    term.cls();
    }
}

<</CODE>>
04 Dec 2012

#include "mbed.h"
#include "Terminal.h"                           //header file for terminal screen

Terminal term(USBTX, USBRX);                    //setup USB interface to host terminal
AnalogIn mypot(p20);                            //Assign mypot to analog input on pin20

float array1[100];
float x, y;
float sum;
int q, r;
  
int main() 
{

    while(1) 
    {
    
    x=mypot.read();                 //reads value of pot
    
    //**************Raw value section of program to show value is correct*****************
    
    //term.printf(" Raw Value = ð.2\n   ",x*3.3);
    
    
    //Add together 10 values from piezo sensor
    for ( q=0; q<99; q++);
    {
    array1[q]=x;
    //wait(0.1);
    }
    
    sum=0;                                               
            for (r=0;r<=99;r++)                                
            {
            sum = sum+array1[r];
            }
            
    sum=sum/100;        
    y=sum*3.3;
    x=x*100;
    term.printf(" Raw Value = ð.2     Value 1 = ð.2\r  ",x,y);       //print value on teraterm
        
    //wait (0.2);                     //wait 0.2 seconds between samples
    term.cls();
    }
}

Lowercase for the code tags fixes it :)

Regarding your problem, increasing baudrate might help, also clearing the screen directly in front of the printf will help a bit. (especially with some delay, there is really not much point in updating it faster than you can read it). I never actually used the terminal library myself, I always simply use serial and not the extra terminal functions. But you can try using the locate function instead of cls, so it would overwrite the old printf instead of clearing the entire screen. Even better, it then isnt required to rewrite stuff like "Raw value", but you only need to overwrite the actual data.

04 Dec 2012

Thanks for the reply. Ill try out the locate function. As for the baud rate, using teraterm I seem to only be able to use 9600. If I put it on any other it shows weird symbols and random stuff. I take it when you say use serial, you mean put it directly to the pc. Can you give me some advice on this and what program to use on the pc to display it?

Thanks

Rob

05 Dec 2012

Re. weird. stuff, both P.C. and MBED must be set to SAME baud rate.

as for "normal " serial, teraterm, terminal etc will work. but just set to serial. I do not use these myself but every one else does! Ceri

05 Dec 2012

Thanks for the advice. I have my teraterm set to serial. I have tried to use the locate function but it doesn't seem to work. It would be better to leave 'value' on the screen and just overwrite the value but I can't seem to do this. Can anyone help? Thanks Rob

16 Dec 2013

Pls can someone help me out. I am having difficulty connecting mbed to teraterm. The serial port is not highlighting for me to choose serial port. Any info please

29 Dec 2013

Yeah. Try using VT100 codes instead of doing a terminal clear. printf("%c[H Level 6 Movement", 0x1B);

0x1B is the VT100 escape code. %c prints that escape code. [H move the cursor to the home position (upper left hand of the screen) without deleting any of the current information on the screen.

You might find this helpful for looking up VT100 codes: http://www.termsys.demon.co.uk/vtansi.htm