#include "xparameters.h"
#include "xtmrctr.h"

#define PERIOD 0x000FFFFF
#define HIGHTIME 0x00003FFF

int main()
{
//PWM funkce OK
	volatile int i;
	print("Pr. 5.10 PWM \n\r");
	//nsataveni TSCR 0 a 1
	XTmrCtr_mSetControlStatusReg(XPAR_TMRCTR_0_BASEADDR, 0,0x00000206);
	XTmrCtr_mSetControlStatusReg(XPAR_TMRCTR_0_BASEADDR, 1,0x00000606 );
	
	for(;;)//program pro cyklickou zmenu stridy
	{
		for(i = 0; i<PERIOD; i++)
		{
			XTmrCtr_mSetLoadReg(XPAR_TMRCTR_0_BASEADDR, 0, i);
			XTmrCtr_mSetLoadReg(XPAR_TMRCTR_0_BASEADDR, 1, HIGHTIME);
		}
		for(i = PERIOD; i>0x0000000; i--)
		{
			XTmrCtr_mSetLoadReg(XPAR_TMRCTR_0_BASEADDR, 0, i);
			XTmrCtr_mSetLoadReg(XPAR_TMRCTR_0_BASEADDR, 1, HIGHTIME);
		}
	}

	return 0;

}