Quantcast
Channel: EngineersGarage - AVR
Viewing all 86 articles
Browse latest View live

"Hello World!" with ATxmega256A3

$
0
0

Forums: 

Hi all,

I am using two radio extender boards from a REB233SMAD-EK kit and an AVRISP mkII programmer in Atmel Studio 6.2. Though the two boards seem to be recognizing each other (LED diodes blink to show successful wireless communication), I cannot find a way in which to get them to send/receive a simple message (such as "Hello World!"). I've been told that the AVRISP mkII is simply a programmer, meaning it doesn't debug. Because of this, whenever I try to debug the following code, Atmel Studio consistently displays an error message stating "Failed to launch program. Error: Failed to start programming session before chip erase with eeprom preserve:Failed to enter programming mode. Error status received from tool: Result received is 0x03.":

/*
* Hello_World.c
*
* Created: 8/21/2015 2:23:17 PM
*  Author: Hugo
*/


#include <stdio.h>
#include <avr/io.h>

static int uart_putchar(char c, FILE *stream);
static void uart_init (void);

static FILE mystdout = FDEV_SETUP_STREAM (uart_putchar, NULL, _FDEV_SETUP_WRITE);


int main (void)
{
    uart_init();
    stdout = &mystdout;
  
    while (1)
    printf("Hello, world!\n");
}


static int uart_putchar (char c, FILE *stream)
{
    if (c == '\n')
    uart_putchar('\r', stream);
  
    // Wait for the transmit buffer to be empty
    while ( !( USARTC0.STATUS & USART_DREIF_bm) );
  
    // Put our character into the transmit buffer
    USARTC0.DATA = c;
  
    return 0;
}


// Init USART.  Transmit only (we're not receiving anything)
// We use USARTC0, transmit pin on PC3.
// Want 9600 baud. Have a 2 MHz clock. BSCALE = 0
// BSEL = ( 2000000 / (2^0 * 16*9600)) -1 = 12
// Fbaud = 2000000 / (2^0 * 16 * (12+1))  = 9615 bits/sec
static void uart_init (void)
{
    // Set the TxD pin high - set PORTC DIR register bit 3 to 1
    PORTC.OUTSET = PIN3_bm;
  
    // Set the TxD pin as an output - set PORTC OUT register bit 3 to 1
    PORTC.DIRSET = PIN3_bm;
  
    // Set baud rate & frame format
    USARTC0.BAUDCTRLB = 0;            // BSCALE = 0 as well
    USARTC0.BAUDCTRLA = 12;
  
    // Set mode of operation
    USARTC0.CTRLA = 0;                // no interrupts please
    USARTC0.CTRLC = 0x03;            // async, no parity, 8 bit data, 1 stop bit
  
    // Enable transmitter only
    USARTC0.CTRLB = USART_TXEN_bm;
}

 

I am unsure of how to get the "Hello World!" message communicated between my two boards using the AVRISP mkII. Would I need a debugger? Is there a way I can program without it?

Any help would be very appreciated!!


auto intensity control of street light with vehicle detection

$
0
0

Forums: 

I am using amega8L-8PU microcontroller. please help me in the coding in C for the project auto intensity control of street light with vehicle detection.

Description:

the led should glow (eg from 6 pm to 12 am) with the help of ldr and ds1307 rtc and should stop glow after 12 am. the infrared sensor should come into action then which should detect the vehicles if any and the led should glow after the vehicle has been detected for certain time and automatically stop glowing. this should continue till 6 am.

GPS navigator

$
0
0

Forums: 

Are there different atmega 16 kits for different frequencies like one for 2 MHz and other for 16 MHz 

If I want to work on gps navigator what will be the components required I have already read the description provide on engineers garage.....

Do i need to have anything else if I have atmega16 kit, STK500, lm16 lcd (2x16)

MOst of the progrrams that I have performed on atmega16 kit have operating frequency of 2 Mhz but i need 16 mhz for the gps navigator.....

Please reply

LCD print

$
0
0

Forums: 

how to ir sensor use as input in atmega8. an that input use as a switch to  print the text on lcd 16X2.

Need to read the internal Register of EMC1701 using Atmega16 micro controller

$
0
0

Forums: 

I need to read internal register of EMC1701  which measure voltage and current

this register i have  to read through the I2C , my problem is i am not able to configure register of EMC1701

EMC1701 contain many register but i dont know which register to read. 

EMC1701 contain

               1.  Sense Voltage Registers

                2.Source Voltage Registers

                3.Current Sense Sampling Configuration Register

               4.Voltage Sampling Configuration Register

      and many more....

 

        

please help me ..........

How to use TWI predefined function in Atmel studio ID

$
0
0

Forums: 

Hi Friend..

I want to use TWI and EEPROM predefined function in Atmel studio

Just like TWI_START(),     TWI_STOP(),     TWI_READ(),    TWI_WRITE(),    EEPROM_WRITE(),     EEPROM_READ()

How use this function?

Where i can find this function ?

To use this function what i have to do ?

 

How to read 16 bit of data using I2C/TWI Protocol

$
0
0

Forums: 

Hi friends

 I have slave device INA219 which has 16 bit resister, and i have to read this 16 bit resister using I2C/TWI Protocol

my confussion is I2C has Data resister(TWDR) 8bit then how to read 16 bit ?

 

Here i have written I2C/TWI Read function 

 

 

void TWI_read_data(void)
{
TWCR=(1<<TWINT)|(1<<TWEN);    // Clear TWI interrupt flag,Enable TWI
while (!(TWCR & (1<<TWINT))); // Wait till complete TWDR byte transmitted
while((TWSR & 0xF8) != 0x58); // Check for the acknoledgement
recv_data=TWDR;
PORTB=recv_data;
 

Interfacing P10 LED panel to atmega8 controller

$
0
0

Forums: 

am using atmega8 avr controller and i need help for interfacing P10 LED panel to the controller(atmega8)

so please help me for interfacing and programming for P10 LED panel

 


Readind SMS from sim900 gsm module and displaying on LCD using ATmega 8

$
0
0

Forums: 

I want to make sms based E notice board ,in this project i wnt to read message from gsm sim 900 which is send with the help of mobile phone and want to display on 16*2 Lcd but facing problem on making code.

So please Provide Code For this Project.

Thanks

help I Need power factor meter project and its code

$
0
0

Forums: 

I have job to make power factor meter using atmega16 and showing the measurement on lcd 16x2 Is any one have the simulation project and c code make from codevision avr if u have please help me as soon as possible? send me your project to avarendra@gmail.com please i need your help thanks..

Microcontroller Selection??

$
0
0

Forums: 

Hello Everyone,

I have to do a project in which I need to use microcontroller. The choice is mine which to use. The micocontroller must be compatible to main two process.
1. I have to do FFT analysis and get the reading. (Too much data, I guess memory should be concerned also)
2. SPI interface too send those data to another device.

My question is which controller have inbuilt best and easy library to conduct these operation and can do it faster with high efficiency. i do have a bit experience with microcontroller but selecting one is confusing.
I did use stm32 and arduino.
I will really appreciate the help in this regards.

Thanks a lot

class monitering system

$
0
0

Forums: 

Hi friends,

                 Iam new to programming , so since am doing avr based project first time i need help from you . i want to interface a lcd, led ,speaker and few switches . the purpose of lcd is to display the date and time with status changes from hour to hour updating status .and the led to indicate the time hour is about to complete and the speaker act as an scheduled alaram daily 7 times . and finally switches to change or update date and time .
                       Please help me out with circuit daiagram using atmeg16 and code for it . and also suggest me as source to learn programming so that in future i can do it by myself .
                                                                    thankyou!

class monitering system

$
0
0

Forums: 

Hi friends,

                 Iam new to programming , so since am doing avr based project first time i need help from you . i want to interface a lcd, led ,speaker and few switches . the purpose of lcd is to display the date and time with status changes from hour to hour updating status .and the led to indicate the time hour is about to complete and the speaker act as an scheduled alaram daily 7 times . and finally switches to change or update date and time .
                       Please help me out with circuit daiagram using atmeg16 and code for it . and also suggest me as source to learn programming so that in future i can do it by myself .
                                                                    thankyou!

OV 7670 and Atmega 128l

$
0
0

Forums: 

I'm working on project that requires using camera. In few words I need to know point coordinates that I will get from video. I will use uC to do some simple counting. Results will be saved on SD card and displayed on LCD. 

For my project I want to use OV7670 Camera Module. I'm not really experienced so my question is: Is 8-bit Atmega128L good enough to operate the camera module and get a quite smooth video?

I'd be more than glad if someone gave me some advice.
Thanks for your attention.
 
 
 

 

how to program mc 89c55

$
0
0

Forums: 

hello., how to program microcontroller AT89C55???? thanks in advance,


source code

$
0
0

Forums: 

can anyone please provide the source code for exam paper leakage protection system?

programming problem with atmega32

$
0
0

Forums: 

hello
i want to store a pin status for atmega32(i.e PINC.1) in eeprom so the volage on this pin is as that was before power off so how i store it. and also i want to store a mobile number once and it remain all time of life cycle(for gsm based project) and compare it when a call will make on gsm modem
so give me some code idea

Can anyone help me in writing avr code to below mentioned problem statement...

avr microcontroller

$
0
0

Forums: 

How can I learn ABC of AVR microcontroller peripheral features with necessary codes and circuit diagram?

R305 interfacing with avr

$
0
0

Forums: 

Can you please send me the uart.h and lcd.h file so that I can get the idea, how to use the instructions of R305? Email id namrata.egg12@gmail Thank you.
Viewing all 86 articles
Browse latest View live


Latest Images