Jim Bartling

...

Discussion created by Jim Bartling on Feb 11, 2020
Latest reply on Feb 12, 2020 by Petr Stancik

 

Sent from Mail for Windows 10

I am trying to get the FIRC out to pb5 the following code compiles but traps on the highlighted statement when I try to right the pin mux.

 

/ port setup

 

     PTB -> PDDR     |= 0b10000;                                             //Set PORT B5 to an output register

 

 

 

 

 

     PORTB-> PCR[0b100000] |= 0b10100000000;                     //set port function to 5 for clkout function

 

     SCG ->FIRCDIV |= 0b100000000;                                   //Set CLKDIV2 to Divide by 1

     SCG-> FIRCCSR |= 0b1001;                                        //Enable FIRC regulator and FIRC

 

 

     SIM->CHIPCTL |= SIM_CHIPCTL_CLKOUTSEL(0b0110);               // select FIRC for input to clkout multiplexor

     SIM->CHIPCTL |= SIM_CHIPCTL_CLKOUTDIV(0b101);               // set clkout divisor to 6 for 8MHz output

     SIM->CHIPCTL |= SIM_CHIPCTL_CLKOUTEN(0b1);                    // enable clkout

 

     int counter = 0;

 

     for (;;) {

          counter++;

          counter %= COUNTER_LIMIT;

     }

 

Any suggestions on how to modify this line of code

 

Jim

 

Outcomes