Tool/software: Code Composer Studio
How do I create a microsecond delay function MSP432?
I have thought of two ways:
1.
#define CPU_FREQ 3000000
#define delay_us(t) (__delay_cycles(((t)*CPU_FREQ/1000000)))
//doesn't work effectively
2. I still need to fully understand how I can do this as I am not sure about the numbers I need to insert to divide from j:
// Calibrated for 40 us
uint32_t j;
uint16_t us_8 = us/8;
uint32_t clk_freq = CS->CTL0;
case(CS_CTL0_DCORSEL_0): for(j=0; j<us_8-5; j++){}
break;
case(CS_CTL0_DCORSEL_1): for(j=0; j<us_8-10; j++){}
break;
case(CS_CTL0_DCORSEL_2): for(j=0; j<us_8-; j++){}
break;
case(CS_CTL0_DCORSEL_3): for(j=0; j<us_8-; j++){}
break;
case(CS_CTL0_DCORSEL_4): for(j=0; j<us_8-; j++){}
break;
}
