7 years, 12 months ago.

nothing appear on tera term.

#include "mbed.h"      
#include "rtos.h"       
#include "stdio.h"     
#include "C12832_lcd.h"

Serial pc(USBTX, USBRX);
C12832_LCD lcd;
AnalogIn Ain(p20);
Mutex lcd_mutex;

void thread(void const *arge)
{
    int col,height;                 
    float ADCdata;                  
    
    while(1)                        
    {
        lcd_mutex.lock();          
        
        int c1=0,c2=0,c3=0;   
        float d=0,e=0;                      
        
        for(col=0; col<129; col++)        
        {            
            ADCdata = Ain*3.3;             
            height=31-int(ADCdata*10);      
            
            lcd.pixel(col, height, 1);
            
            wait(0.005);
            lcd.copy_to_lcd();
            lcd_mutex.unlock();
            
            d=ADCdata;
            
            if( d>e && d>=1)
                {
                c1=col;
                }                
            else if(c2 == 0 )
                {
                c2 = c1;
                c1 = 0;
                }
                else if(c3==0 && c2!=0)
                    {
                    c3=c1;
                    }
                    e=d;                   
                    if(c1!= c3 && c1!=127 && c3!=0)
                        {
                       lcd.locate(0,0);
                       int d = abs(c3-c2)+abs(c1-c3);
                       lcd.printf("%d BPM\n", d);
                        }
        else if(c3!=0)
            {
            lcd.locate(0,0);
            int d1=(abs(c3-c2)*10);
            lcd.printf("%d BPM", d1);
            }
            wait(0.0000005);
            
        }
        int distance=abs(c3-c2)+abs(c1-c3);
        wait(1);
        pc.printf("Heart rate = %d bpm\n", distance);
        if(distance < 101 && distance > 59)
        {
            pc.printf("Heart rate = = normal\n");
            }
            else if(distance > 100)
            {
                pc.printf("Heart rate = not normal, see a doctor\n");
                }
                else 
            {
                pc.printf("Heart rate = unhealthy, go for a checkup\n");
                }
                lcd.cls();
                }
        }

int main()
{  
    lcd.cls();
    Thread t(thread);
    while(1);
}           

this is my programing for the ECG signal from the LCD to the tera term but the tera term didn't appear anything at all. Please help me in this!

Please use

<<code>>
your code...
<</code>>

When posting code so that the formatting is maintained.

posted by Andy A 27 Apr 2016

alright done thanks.

posted by kevan foong 27 Apr 2016

2 Answers

7 years, 12 months ago.

make sure that your baud rate of your tera term matches the baud rate of your program :)

i've tried every baud rate but nothing appeared as well.

posted by kevan foong 27 Apr 2016

Since you aren't setting anything the port should be 9600 baud. 8 bits, 1 stop bit, no parity.

posted by Andy A 27 Apr 2016

yes i've done what u stated but still no.

posted by kevan foong 29 Apr 2016
7 years, 12 months ago.

For Windows, you have to install serial driver.

https://developer.mbed.org/handbook/Windows-serial-configuration

is serial driver and serial port the same? the terminal receive line i also change it to LF.

posted by kevan foong 29 Apr 2016

If you install the serial driver successfully, you will see a valid "mbed Serial Port (COMx)" in the device manager. Then, you can set the port number to the serial port setting of tera term .

posted by Toyomasa Watarai 29 Apr 2016

for mine it appeared as COM4.

posted by kevan foong 29 Apr 2016

Okay, so you can set COM4 to the serial port setting of Tera Term.

posted by Toyomasa Watarai 30 Apr 2016

set it already but still nothing came out. is there something wrong with my programming? because no matter how I change eg. terminal receive, serial port it still doesn't wrong

posted by kevan foong 30 Apr 2016