Skip to content

Configurable custom logic - ATTINY 1614 #1197

Answered by dave2fn
dave2fn asked this question in Q&A
Discussion options

You must be logged in to vote

Problem was not setting takeOverTCD0(); . Once I did that it started working. Below is the working program using megaTinyCore

#include <avr/sleep.h>

void TCB0_init(void)
{
  TCB0.CTRLA = TCB_CLKSEL_CLKDIV2_gc  /* CLK_PER/2 (From Prescaler) */
  | 1 << TCB_ENABLE_bp;               /* Enable: enabled */

  TCB0.CTRLB =  1 << TCB_CCMPEN_bp    /* Pin Output Enable: enabled */
  | TCB_CNTMODE_PWM8_gc;              /* 8-bit PWM */

  TCB0.CCMP = 0x28FF;                 /* 8-bit mode. Period = 255 (0xff), cmp = 40 (0x28) */
}

void init_IO_pins(void) {
	
	/*
	 * Set all IO pins as input with pull-up enabled and 
	 * digital input buffer disabled to minimize power consumption 
	 */ 
	
	PORTA.DIR = 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dave2fn
Comment options

Answer selected by dave2fn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants