Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
478 B
4
Indexable
Never
#include "st72334n2.h"

void led_init(void)
{
  PBDDR |= (1<<7)|(1<<6)|(1<<5);  //DDR=1
  PBOR  |= (1<<7)|(1<<6)|(1<<5);  //OR=1 -> output/pp
}

void tim_init(void)
{
  TACR2 |=   1<<3;	//CC1=1
  TACR2 &= ~(1<<2);	//CC0=0 -> ftim=fcpu/8=1MHz -> 1us

  TACR1 |= (1<<6)|(1<<5);  //TOIE=1, OCIE=1 -> local interrupt enable
	
	
	
}

main()
{	
	led_init();
	tim_init();
	
	#asm
	rim    //-> global interrupt enable
	#endasm
	
	while (1)
	{
		
	}
}