Hi - I am trying to use the delay_ms function, but seem to be having a few problems;
I am using an EVK1101 board.
I have added delay routines from the ASF under services and hit apply. (I can see delay.h in the solution explorer under the delay folder)
I added delay_init(); after the main start.
I tried delay_ms(2000), but it doesn't seem to delay.
I got it to work by going to the delay.h file and edited:
#ifndef F_CPU # define F_CPU sysclk_get_cpu_hz() #endif
#ifndef F_CPU # define F_CPU 12000000 #endif
so it's as though sysclk_get_cpu_hz is not getting the value of the 12mhz xtal.
In the conf_clock.h file I see:
#ifndef CONF_CLOCK_H_INCLUDED #define CONF_CLOCK_H_INCLUDED //#define CONFIG_SYSCLK_INIT_CPUMASK (1 << SYSCLK_SYSTIMER) //#define CONFIG_SYSCLK_INIT_PBAMASK (1 << SYSCLK_USART0) //#define CONFIG_SYSCLK_INIT_PBBMASK (1 << SYSCLK_HMATRIX) //#define CONFIG_SYSCLK_INIT_HSBMASK (1 << SYSCLK_MDMA_HSB) #define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_RCSYS //#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_OSC0 //#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_PLL0 /* Fbus = Fsys / (2 ^ BUS_div) */ #define CONFIG_SYSCLK_CPU_DIV 0 #define CONFIG_SYSCLK_PBA_DIV 0 #define CONFIG_SYSCLK_PBB_DIV 0
Another point - elsewhere on the forum it was said you don't have to include delay.h at the top of the main file ??
I have to do this or else it doesn't see F_CPU and the delay routines.
What am I (obviously) doing wrong?
I tried #include <asf.h> which doesn't give errors, but still doesn't work - which file to include?
I am new to the UC3, having worked a lot with Mega AVRs - What a learning curve! It's an ARMy of info!