CRIANDO UM PROJETO NOVO NO CCS
TIVA C TM4C123GH6PM
1-Criar novo Projeto (CCS Project)
2-Propriedades -> General -> Main -> Connection
-> Stellaris
3-Propriedades -> General -> Products -> marcar TM4C ARMA
4-Propriedades -> Build -> ARM Compiler -> Include
Options -> Add dir (botão add) -> C:\ti\TivaWare_C_Series-2.1.3.156
5-Propriedades -> Build -> ARM Compiler ->
Predefined Symbols -> Pre-define Name (botão add) -> TARGET_IS_TM4C123_RB1
6-Propriedades -> Build -> ARM Linker -> File Search
Path -> Include library file (botão add) ->
C:\ti\TivaWare_C_Series-2.1.3.156\driverlib\ccs\Debug\driverlib.lib
7-Clique no projeto com o botão direito -> New -> Target configuration file
8-New -> Source File
Para Compilar e Executar pressione F11 e depois F8
Atalho para Debug = F8
Atalho para executar = F11
Exemplo de programa para teste
#include <stdbool.h>
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#define RED_LED GPIO_PIN_1
#define BLUE_LED GPIO_PIN_2
#define GREEN_LED GPIO_PIN_3
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t
ui32Line)
{
}
#endif
int
main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF))
{
}
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED);
while(1)
{
GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, RED_LED);
SysCtlDelay(10000000);
GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, BLUE_LED);
SysCtlDelay(20000000);
GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, GREEN_LED);
SysCtlDelay(30000000);
}
}