hello

Started by sellitas September 4, 2008
hello i am new user and i need help on c programming code using
Timer/Counter to switch led on and off using avr and i'm using atmega
644 microcontroller
Hi,

What have you done so far? What problems are you having?

Zack

On Thu, 4 Sep 2008, sellitas wrote:

> hello i am new user and i need help on c programming code using
> Timer/Counter to switch led on and off using avr and i'm using atmega
> 644 microcontroller

thanks for u'r response what i did so far is i use AVR microcontroller and atmega644 and i did the input output pin configuration i connect input to TOSC1 pin and output to PORTB, i choose the Timer that is Timer 1, i selectPORTBis led's & testing using DDRB = 0xFF;

1-select the timer -Timer 1
2-select PORTB is led's and testing - DDRB = 0xFF;
- PORTB = 0x00;
3- select clock source internal clock source(prescaler)- TCCR1B =0x02timer1 uses clock\8
4- i want to initialize the Timer/Counter value TCNTn = 0xFFFF; and i want to make loop to turn led on when it reaches some value compair with OCRnx compair match register
so i came this far and my problem is how to initialize the Timer/Counter value and how to make a loop to switch led on and off .
THANK YOU!!

--- On Thu, 9/4/08, Zack Widup wrote:

From: Zack Widup
Subject: Re: [AVR club] hello
To: a...
Date: Thursday, September 4, 2008, 8:13 AM

Hi,

What have you done so far? What problems are you having?

Zack

On Thu, 4 Sep 2008, sellitas wrote:

> hello i am new user and i need help on c programming code using
> Timer/Counter to switch led on and off using avr and i'm using atmega
> 644 microcontroller





thanks for u'r response what i did so far is i use AVR microcontroller and atmega644 and i did the input output pin configuration i connect input to TOSC1 pin and output to PORTB
and the code is

# include

void main()
{
DDBB = 0xFF; // make port Boutput
PORTB= 0XFF;

TCCR1B = 0X00; // stop timer
TCCR1B = 0X02; // start timer with clk/8

i want to initialize the Timer/Counter value TCNTn = 0xFFFF; and i want to make loop to turn led on when it reaches some value compair with OCRnx compair match register

so i came this far and my problem is how to initialize the Timer/Counter value and how to make a loop to switch led on and off .

thank you!!!


--- On Thu, 9/4/08, Zack Widup wrote:

From: Zack Widup
Subject: Re: [AVR club] hello
To: a...
Date: Thursday, September 4, 2008, 8:13 AM

Hi,

What have you done so far? What problems are you having?

Zack

On Thu, 4 Sep 2008, sellitas wrote:

> hello i am new user and i need help on c programming code using
> Timer/Counter to switch led on and off using avr and i'm using atmega
> 644 microcontroller





thanks for u'r response what i did so far is i use AVR
microcontroller and atmega644 and i did the input output pin
configuration i connect input to TOSC1 pin and output to PORTB, i
choose the Timer that is Timer 1, i select PORTB is led's & testing
using DDRB = 0xFF;

1-select the timer -Timer 1

2-select PORTB is led's and testing - DDRB = 0xFF;
- PORTB = 0x00;
3- select clock source internal clock source(prescaler)-
TCCR1B = 0x02 \\timer1 uses clock\8

4- i want to initialize the Timer/Counter value TCNTn = 0xFFFF; and
i want to make loop to turn led on when it reaches some value
compair with OCRnx compair match register

so i came this far and my problem is how to initialize the
Timer/Counter value and how to make a loop to switch led on and off .

THANK YOU!!

--- In a..., Zack Widup wrote:
> Hi,
>
> What have you done so far? What problems are you having?
>
> Zack
>
> On Thu, 4 Sep 2008, sellitas wrote:
>
> > hello i am new user and i need help on c programming code using
> > Timer/Counter to switch led on and off using avr and i'm using
atmega
> > 644 microcontroller
> >
>