[SOLVED] Problem in setting the Baud Rate in AVR...

Status
Not open for further replies.
@madhu
Sir

1) I think understand Brown-out detection i think it will manage the supply voltage if any fluctuation is happen am i correct?
2) should i do this pin 0 or 1 sir

Ismail
 

CKSEL0 = 0
CKSEL1 = 1
CKSEL2 = 1
CKSEL3 = 1

SUT0 = 0
SUT0 = 1

CKPOT = 0

is giving this is as fuse bits not write

Ismail
 

is giving this is as fuse bits not write

Ismail

I don't understand what you mean

- - - Updated - - -

Note that CKOPT should be 1 for crystals >8MHz
EDIT: sorry , this was wrong, the CKOPT should be=0

 
Last edited:

i am sorry...
Sir...
i am not getting what to do with this the fuse bit...
the setting i have made is just like this in the screen shot...
the burner stopped detecting it...
uC is stopped responding...
what to do sir...
 

Attachments

  • Untitled.png
    679 KB · Views: 84

These values are correct (by mistake I wrote CKOPT=1 in a previous post but should be =0).
Have you connected a crystal with the two capacitors in the XTAL pins?
 

These values are correct (by mistake I wrote CKOPT=1 in a previous post but should be =0).
Have you connected a crystal with the two capacitors in the XTAL pins?

Yes sir i have did the same thing...
 

I can't provide any solution, if the fuses are correct and the crystal is connected I have no idea what can be wrong unless reset or ISP has been disabled.
Does the crystal oscillate?
See if you can measure 2.5v DC in the crystal pin
 

:?: what do you mean, I just asked you to measure a voltage , how did that fix your problem?
 

Does the crystal oscillate?

I got hint by your this Quote...when i seen the crystal word in Quote... I Checked the connectivity between the ceramic cap and crystal... 1 cap was connected with the crystal and another was not some dry solder was there i think...
that is way it was giving the output when the default 1MHz internal clk is running and when we configuring it to the external crystal it stops responding....

Thank you so much Sir. You helped me so much More then a teacher dose...

Ismail
 

hope this can also help
Code:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
 
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))
#define CLEARBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
#define FLIPBIT(ADDRESS,BIT) (ADDRESS ^= (1<<BIT))
#define CHECKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT))
#define WRITEBIT(RADDRESS,RBIT,WADDRESS,WBIT) (CHECKBIT(RADDRESS,RBIT) ? SETBIT(WADDRESS,WBIT) : CLEARBIT(WADDRESS,WBIT))
 
volatile uint8_t my_flag;	//flag created to draw diverter 
volatile uint8_t my_flagSC;	//flag created to stop conveyor
 
void usart_init(void);
 
void usart_init(void)
{
    UCSRB = (1 << RXEN) | (1 << TXEN) | (1 << RXCIE)  ; //ENABLE RECEIVER,TRANSMITTER AND RECEIVE INTERRUPT
    UCSRC = (1 << UCSZ1) | (1 << UCSZ0) | (1 << URSEL); //USE 8 BIT DATA TRANSFER AND ONE START ONE STOP BITS WITH 9600 BAUDRATE
    UBRRL = 0x33;
}
 
int main(void)
{
   
    DDRA = 0xFF;        //PORT A IS OUTPUT
    usart_init();
   
    GICR = (1<<INT0)|(1 << INT2); //ENABLE EXTERNAL INTERRUPT 0&2 ON PORT D^2 & B^2
    MCUCSR = (0 << ISC2); //whenever the interrupt 2 is high to low(negative edge triggered)
    MCUCR=0x02;//MAKE INT0 FALLING EDGE TRIGGERED
	sei();

 
while(1)            //continue the following process
{
    if(my_flag == 1)    // check if flag is 1 and execute the following code for running diverter motor after rs232 interrupt
    {
        my_flag = 0;    // reset the flag
        SETBIT(PORTA, 0); // set bit0 of PORTA to 1
        _delay_ms(5000);    // delay 1000ms or as much as you want
        CLEARBIT(PORTA, 0); // set bit0 of PORTA to 0
    }
}
}
 
ISR(INT2_vect)
{
	my_flagSC=1;
    usart_send('C');    //JUMP TO VOID USART_SEND TO SEND THE ASCII CHRACTER C  to matlab from 15th pin of UC FOR CAPTURING FRAME FROM CAMERA
}
void usart_send(unsigned char g)
{
	UDR = g; //PUT CHRACTER B IN USART DATA REGISTER TO TRANSMITT
	if(my_flagSC==1)
	{
	my_flagSC=0;	
	SETBIT(PORTA,4);// set bit4 of PORTA to 1
    _delay_ms(5000);    // delay 10000ms or as much as you want to stop conveyor
    CLEARBIT(PORTA, 4); // set bit0 of PORTA to 0
	}    
	
}
 
ISR(USART_RXC_vect)     //RECEIVE INTERRUPT
{
    unsigned int d;
    d = UDR;
    my_flag=1; // set the flag when the interrupt occurs
}

ISR(INT0_vect)
{
	
    usart_send('D');    //JUMP TO VOID USART_SEND TO SEND THE ASCII CHRACTER B  to matlab from 15th pin of UC
	
}
 

@numair_noor

thanx but few years ago its done;...

But thanx for the reply

Ismail
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…