Page 1 of 1

Avr beginner with avrcam

PostPosted: Wed Mar 29, 2006 11:52 am
by arvind
Am just trying to PING the avrcam from the micro(atmega8535). Am using peter fleury's uart library. The mega8535 is running with an external 8Mhz crystal oscilator.This is the code:
Code: Select all
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
#include <avr/pgmspace.h>
#include <string.h>
#include <inttypes.h>

#include "uart.h"
#include "lcd.h"

#ifndef F_CPU
#define F_CPU 8000000UL
#endif

#define UART_BAUD_RATE    115200     


int main(void)
{
    unsigned int c;
      
   
    uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) );
   
    sei();
   uart_puts("PG");
   lcd_init(LCD_DISP_ON);
    lcd_clrscr();
    lcd_puts("Cam:");
    lcd_command(LCD_DISP_ON_CURSOR_BLINK);
   
for(;;)
    {
     c = uart_getc();
    
     if ( c & UART_NO_DATA )
        {
        }
        else
        {
       lcd_putc((unsigned char)c);
       lcd_putc("a");
      }
    }
   
}


Now nothing gets printed on the lcd after "cam:". I dont know whats wrong...
The avrcam has worked properly when "PING"ed from the avrcamview pc application.please help me..i need to get it working..n am a beginner at embedded programming

Ping avrcam from mega8535

PostPosted: Fri Mar 31, 2006 10:31 am
by arvind
Well, i learnt that i should not have used 8Mhz crystal as the error in serial transmission was very high. Hence i have used 11.0592Mhz crystal and have succesfully transmitted data serially to hyper terminal at 115.2kbps. But even now, when i try pinging the cam from the micro, the cam does not respond. Nothing is recieved by the micro.Please help me..am just not able to find out what is wrong...

PostPosted: Sat Apr 01, 2006 12:45 pm
by johno
So when you send the PG\r (ping) command to the AVRcam from your board, what do you receive back? When you are trying to talk to the AVRcam from another AVR board, I assume you are communicating through the TTL-level UART interface, and not the RS-232-level UART interface, right?

dumb mistake

PostPosted: Sun Apr 02, 2006 4:21 am
by arvind
i had made a dumb mistake....had connected the rx of mega8 to rx of mega8535 directly instead of tx... :( :oops: