Microcontroller › AVR › Problem with receive complete interrupt in AVR studio 4
- This topic has 0 replies, 1 voice, and was last updated 13 years, 2 months ago by
Dhruwank Vankawala.
-
AuthorPosts
-
February 27, 2012 at 9:42 am #1628
Dhruwank Vankawala
ParticipantHey, frds
i am trying to run a code which is related with interfacing of GSM modem with ATMEGA 32.
i have done programming on interupt based…..
Bt incase of interupt service routine i dint come out of that routine ……………..
and the code is not running on both proteus and atmega 32 kit………….
Here is the reference code for it……….
#include<avr/io.h>
#ifndef F_CPU
#define F_CPU 11059200UL // 11.0592MHz clock speed #endif
#endif#include<util/delay.h>
#include<avr/interrupt.h>#define LCD_PRT PORTC
#define LCD_PIN PINC
#define LCD_DDR DDRC
#define LCD_RS 0
#define LCD_RW 1
#define LCD_EN 2unsigned char x,abc=0,z,ch=0,i,st,flag,enter=0;
char msg[150];
char cmti[]=”+CMTI”;/*typedef struct bitfield
{
unsigned char bit1:1;
}bitfield;bitfield flag;*/
void UART_init()
{
UCSRB = ((1<<TXEN)|(1<<RXEN)|(1<<RXCIE)); // Enable UART receiver and transmitter
UCSRC = (1<<UCSZ1) | (1<<UCSZ0) | (1<<URSEL);
UBRRL = 0x47;
}void tx(unsigned char b)
{
while(!(UCSRA & (1<<UDRE)));
UDR = b;
}void sendSMS(char* z)
{
unsigned char t;
for(t=0;z[t] != ‘