Other Parts Discussed in Thread: MSP430FG4618
I'm just testing out TImer B on the MSP430FG4618.
I've written a simple program to calculate the length of time it takes to initialise an integer array to zero.
The timer is setup using SMCLK which I believe has a frequency of 1 MHz.
After running through the function, the number of clocks on the TBR register is 1170.
From what I gather this corresponds to (1/1MHz)*1170 seconds = 1.17 ms
Does this length of time seem plausible for simply intialising a seventy element array to zero?
Here is the code used:-
#include <msp430xG46x.h>
int i=0,n=0;
int x[70];
void main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP14PF; // Configure load caps
// Wait for xtal to stabilize
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (i = 0x47FF; i > 0; i--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still set?
while(1){
TBCTL = TBCLR ; //Clear Timer B
TBCTL = TBSSEL_2+MC_2; // Start Timer
for(i=0; i<70; i++){
x[ i ] = 0;
}
n=TBR ; // Read Timer Now
}
}