tiny2313 oc1b no output

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

so I'm working on a project using i2c and cant use counter0 for pwm.. I was using PD6/OC0B

anyway now I need to move to using counter1 but for some reason I can't get a signal on PB4/OC1B.
I must be missing something in the datasheet or overlooking something

I'm attempting mode-5 fast pwm 8-bit
here is my test code any help or direction would be great


	DDRB |= (1<<PB4);
	PORTB &= ~(1 << PB4);
	TCCR1A = (1<<COM1B1)|(1<<COM1B0)|(1<<WGM10);
	TCCR1B = (1<<WGM12)|(1<<CS10);
	TCNT1 = 0;
	OCR1B=128;

EDIT:
alright I did some more testing.. PB4 basic out test pinout output confirmed working
switched the code around for OC1A PB3 and it worked.. so I can work around it like this
but why can't I get output on OC1B/PB4?

here is my changed code

	DDRB   |= (1 << PB3);
	PORTB &= ~(1 << PB3);
	TCCR1A = (1 << COM1A1)|(1 << COM1A0)| (1 << WGM10);
	TCCR1B = (1 << WGM12)|(1 << CS10);
	TCNT1 = 0;
	OCR1A = 128;

solved!.. guess I didnt reload the hex file before programing it.. oops! oh well I learned something :)

Last Edited: Thu. Jul 14, 2022 - 03:17 AM