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.

UART using timers in atmega32

Status
Not open for further replies.

manii120

Junior Member level 1
Joined
Sep 14, 2017
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
India
Activity points
121
can any one please help me out in using timers with uart ??
 

Hi,

Your post is a riddle.

How to configure and use a timer is written in the datasheet.
How to configure and use the UART is written in the datasheet.

If you need help from forum members you should at least provide useful informations.

Currently I cant see what and why you want to do. Why UART and timer?

Klaus
 

I'll provide every information i have, But i need some time to work on that to make it understandable. i'll post that details tomorrow morning.

But i'll tell you my main concern is....i want to call timer interrupt every some ms so in that mean time if any button pressed it will be detected and send data to another microcontroller. In mean while MAIN loop is busy with never end loop whom i don't want to interrupt.
 

Well only the receiving part is in ISR.

The codes i'm using for receiving and ISR is ->
Code:
ISR (TIMER1_COMPA_vect)    // Timer1 ISR
    {
   if(PINA!=0x1f)                  //this is a condition where if any button pressed(out of 5 buttons i am using) will be detected
      {
	 val=PINA;                  
	 button(val);              //passing PINA value  
      }	
	  if((UCSRA&(1<<RXC)))                 //if recevied anytime
	  {
	   received_data=UDR;                  //store the value received
	   decide_func(received_data);      //Passing received value.
	  }
    }
And this is how i set-up my timer1 for CTC mode
Code:
   TCCR1B |= (1 << WGM12)|(1 << CS11)|(1 << CS10);
   TCNT1 = 0;
   OCR1A = 2499;                                                           //I just set this value because it works fine not calculated(please help me here how to 
                                                                                    //determine the value to be set in here.
   TIMSK |= (1 << OCIE1A);
This is how i'm trying to transmit data .
Code:
 while(!(UCSRA&(1<<UDRE)));
	  UDR=0b00000101;
Kindly help me in improving what to say that in technical terms if i were wrong somewhere(So next time i'll be more accurate).
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top