NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Everything Else » Using RealTerm

August 06, 2013
by Ralphxyz
Ralphxyz's Avatar

pcbolt had suggested using RealTerm as the terminal program.

I got my program to compile but I am not getting any output to RealTerm.

Here is my program:

#define F_CPU 14745600

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

//#define UART_BAUD_RATE 2400
#define UART_BAUD_RATE 57600
#include  "uart/uart.h"
#include "adc/adc.h"
#include "acs712/acs712.h"

uint16_t adc = 0;
uint16_t adchisto = 0;

int main(void)
{
    char printbuff[100];
    long l;
    double d;

    //init uart
    uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) );

    //init adc
    adc_setchannel(1);
    adc_init();

    //init interrupt
    sei();

    //main loop
    for (;;)
    {
        //read adc and filter it
        adchisto = adc;
        adc = adc_read(1);
        adc = adc_emafilter(adc, adchisto);

        //print out results
        itoa(adc, printbuff, 10);
        uart_puts("ADC     "); uart_puts(printbuff); uart_puts("\r\n");

        l = adc_getresistence(adc, 10000);
        ltoa(l, printbuff, 10);
        uart_puts("RES     "); uart_puts(printbuff); uart_puts("\r\n");

        d = adc_getvoltage(adc, ADC_REFV);
        dtostrf(d, 10, 5, printbuff);
        uart_puts("VOL     "); uart_puts(printbuff); uart_puts("\r\n");
        d = acs712_getcurrent(adc_getvoltage(adc, ADC_REFV), ADC_REFV);
        if(d < 0.0)
            d=-d;
        dtostrf(d, 10, 5, printbuff);
        uart_puts("CURRENT "); uart_puts(printbuff); uart_puts("\r\n");

        uart_puts("\r\n");

        _delay_ms(1500);
    }

    return 0;
}

At the moment I do not have any ADC input but there should still be output to RealTerm.

I am not sure what I might need to do to (settings) RealTerm.

Ralph

August 06, 2013
by pcbolt
pcbolt's Avatar

Hi Ralph -

Just below the black box terminal screen there are a bunch of menu tabs you can select. One is "Ports" (I think... I don't have RealTerm on the computer I'm at right now). You should be able to change the Comm port selection, baud rates etc and once you do there is a "Change" button that will open the port for you. On the same menu tab, there should a bunch of little squares that will light up if any data comes across. The source forge site should have tutorials to look through...I'll try to post the link when I get a chance.

August 08, 2013
by Ralphxyz
Ralphxyz's Avatar

I loaded up the Nerdkits temp sensor project.

I am still not getting any output in RealTerm:

Here is my ports settings:

I got the ????? on the initial start up but nothing else!

I am running XP Pro on a virtual machine on my Windows 8 computer.

Ralph

August 08, 2013
by Noter
Noter's Avatar

Looks like a baud rate error. The code you listed above appears to be setting the rate to 57600. Give that a try.

August 08, 2013
by Ralphxyz
Ralphxyz's Avatar

Sorry Paul, I had said in my last post I am using the Nerdkits tempsensor code now as I know that works!!

In fact I loaded PUTTY and it works right out of the box, I just set the Port and Baud rate!!

I am sure my problem with RealTerm is a setting.

The only difference I see between RealTerm and Putty is the Flow control:

Putty: Flow control   XON/XOFF

RealTerm does not have the XON/XOFF option which is strange.

All RealTerm has is:

RealTerm Hardware Flow Control  
NONE
RTS/CTS
DTR/DSR
RS485-rts

Oh well I can always use PUTTY just RealTerm looks interesting, plus I want to play with the I2C monitoring.

Ralph

August 08, 2013
by Ralphxyz
Ralphxyz's Avatar

Got it!!

It was a Display setting!!

Looks like uint8 works best!! It defaults to Ascii.

Thanks everyone.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that electric fields behave differently in different materials? Learn more...