Hi,
Is there any good tutorials on how to debug code in CCS?
I am trying to understand how to use CCS's debugging features. so I modified TivaWare project0 to enable the SysTick timer, and record the time between red LED and blue LED flashing, to try to understand how much time it takes between LED changing colors:
int main(void) {
// Setup the system clock to run at 50 Mhz from PLL with crystal reference
//
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
// Enable SysTick timer, 24-bit
// declare variables to store time
//
SysTickEnable();
volatile unsigned long time0, time1, time2, time3;
while(1) {
time0 = SysTickValueGet(); //get initial timer count
//
// Turn on red LED
//
GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED, RED_LED);
//
// Delay for a bit
// 5,000,000 * 3 cycles / 50 MHz = 0.3 Second, I think??
//
SysCtlDelay(5000000);
time1 = SysTickValueGet(); //get timer count after turning on red LED and waiting 5M*3 cycles
//
// Turn on blue LED
//
GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED, BLUE_LED);
//
// Delay for a bit
//
SysCtlDelay(5000000);
time2 = SysTickValueGet();
When I run the debugger and look at the variable values, I get:
time0 value = 0
time1 value = 12
time2 value = 240
These values don't make any sense to me, I was expecting the value to time1 to be 15M+a few cycles because of SysCtlDelay(5M)... What is stored in the value field in the variables window?
Thanks for your help,