void vr_hwag_init(void) { hetREG1->HWAGCR0 = 0; hetREG1->HWAGCR0 |= 1; //HWAG module is not in reset. hetREG1->HWAPINSEL = 0; hetREG1->HWAPINSEL |= 2; //select input n2het[2]. hetREG1->HWAGCR2 = 0; hetREG1->HWAGCR2 |= (1<<16); //Criteria is enabled. hetREG1->HWAGCR2 |= (1<<8); //Filter is enabled. hetREG1->HWAACNT = 128; //Start angle (Ticks period * start tooth) //0h 4 ticks per period //1h 8 ticks per period //2h 16 ticks per period //3h 32 ticks per period hetREG1->HWASTWD = 0x4; //4h 64 ticks per period hetREG1->HWATHNB = 57; //57 for a 60-2 toothed wheel hetREG1->HWATHVL = 2; //Start Tooth hetREG1->HWAFIL = 16; // Ticks * (1 - fil1%) Contains the value to be compared to the tick counter. hetREG1->HWAFIL2 = 48; // Ticks * 3 * (1 - fil2%) Contains the value to be compared to the tick counter during the singularity tooth. hetREG1->HETGCR = 0; hetREG1->HETGCR |= (1<<24); //Enables the pin output buffer structure hetREG1->HETGCR |= (2<<21); //The HTU and the arbiter output use a round robin scheme to access the N2HET RAM. hetREG1->HETGCR |= (1<<16); //N2HET is configured as a master. hetREG1->HETPFR = 0; hetREG1->HETPFR |= (0x5<<8); // /32 Loop-Resolution Pre-scale Factor. hetREG1->HETDIR |= (1<<1); //output n2het[1]. hetREG1->HETPSL |= (1<<2); //pull-up input n2het[2]. n2het_ram_init(hetRAM1,HET_INIT0_PST,3); //loading instructions in to n2het ram hetREG1->HETGCR |= 1; //N2HET is ON. The timer program execution starts synchronously to the Loop clock. hetREG1->HWAFLG = (1<<6)|(1<<2); //Clear Tooth Interrupt Flag and Gap Flag hetREG1->HWAENASET = (1<<6)|(1<<2); //Tooth Interrupt and Gap Flag enable; }
L00 CNT { next=L01,angle_count=ON,reg=B,comp=GE,max=3839,data=128}; L01 ACMP { next = L02, en_pin_action = ON, pin = 1, action = SET, reg = B, data = 3712 }; L02 ACMP { next = L00, en_pin_action = ON, pin = 1, action = CLEAR, reg = B, data = 3776 };
N2HET and HWAG again.
What instructions do I need to use to work with hwag and what is the minimum set for working with it?
I did not find examples for working with a hardware angle generator.