Fast PWM Tiny13A ?

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys,

 

I've been fiddling with FastPWM on Tiny13A to control a brightness of LED, but I haven't got it yet...

Any setting or missing code here ?

 

TCCR0A|=(1<<WGM00)|(1<<WGM01)|(1<<COM0A1)|(1<<COM0A0);
	 TCCR0B|=(1<<CS00);
	DDRB = 0x3F;
	
	void PWMOut(uint8_t out)
{
	OCR0A=out;
}

void LED_0_brightness()
{
	uint8_t b=0;
	 for(b=0;b<255;b++)
	 {
		 //set brightness with PWM

		 PWMOut(b);

		 
		_delay_ms(1000);
	 }
}

The LED is just ON without fading as I expected....do I miss something here ?

 

Thanks

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please show the complete test program.  Please tell your AVR's clock speed.  Please tell how you have your LED connected.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also a schematic might help as well. There is nothing obviously wrong with the code.

Regards,
Steve A.

The Board helps those that help themselves.