The Halcogen contains example code. Click on Help, Help Topics and Examples. I've been trying the RTI and SCI (UART) example and works. The PWM however doesn't work out of box. It requires you to set hetPORT1 direction.
Here is my example:
/** @file sys_main.c
* @brief Application main file
* @date 15.Aug.2012
* @version 03.02.00
*
* This file contains an empty main function,
* which can be used for the application.
*/
/* (c) Texas Instruments 2009-2012, All rights reserved. */
/* USER CODE BEGIN (0) */
/* USER CODE END */
/* Include Files */
#include "sys_common.h"
#include "system.h"
/* USER CODE BEGIN (1) */
#include "het.h"
#include "gio.h"
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
typedef enum count_direction {
COUNT_UP = 0,
COUNT_DOWN
}count_direction;
uint32_t counter = 0;
uint32_t direction = COUNT_UP; //0: up, 1: down
void wait(uint32_t time)
{
while(time){time--;};
}
/* USER CODE END */
void main(void)
{
/* USER CODE BEGIN (3) */
hetInit(); //Using HET1, pwm0 at pin HET 0
gioInit();
gioSetDirection(hetPORT1, 1);
direction = COUNT_UP;
while(1){
if (counter == 100) {
direction = COUNT_DOWN;
} else if (counter == 0){
direction = COUNT_UP;
}
if (direction == COUNT_UP) {
counter++; //count up
}else {
counter--; //count down
}
pwmSetDuty(hetRAM1, pwm0, counter );
wait(20000);
}
/* USER CODE END */
}
/* USER CODE BEGIN (4) */
/* USER CODE END */