Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[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

The CKOPT Fuse selects between two different Oscillator
amplifier modes. When CKOPT is programmed, the Oscillator output will oscillate will a full rail-
to-rail swing on the output. This mode is suitable when operating in a very noisy environment or
when the output from XTAL2 drives a second clock buffer. This mode has a wide frequency
range. When CKOPT is unprogrammed, the Oscillator has a smaller output swing. This reduces
power consumption considerably. This mode has a limited frequency range and it can not be
used to drive other clock buffers.
For resonators, the maximum frequency is 8MHz with CKOPT unprogrammed and 16 MHz with
CKOPT programmed. C1 and C2 should always be equal for both crystals and resonators. The
optimal value of the capacitors depends on the crystal or resonator in use, the amount of stray
capacitance, and the electromagnetic noise of the environment. Some initial guidelines for
choosing capacitors for use with crystals are given in Table 4. For ceramic resonators, the
capacitor values given by the manufacturer should be used.
 
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
    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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top