Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
+ Collaboration diagram for Operating System Time Base:
volatile uint16_t sysOsTimer_Initialize (void)
 Initializes the timer used as time-base for the task scheduler. More...
 
volatile uint16_t sysOsTimer_Enable (volatile bool interrupt_enable, volatile uint8_t interrupt_priority)
 

Detailed Description

A simple 16-bit timer is used to generate the time base of the operating system. This timer is set to overflow after the time period specified by MAIN_EXECUTION_PERIOD in the hardware abstraction layer. This time period is used to pace the high- and low priority task sequences of the main program.

Two public functions are provided to initialize the time base, configuring its desired period as well as setting up the interrupt priority of the high priority task sequence execution, and an ENABLE function, enabling the high priority task sequence execution interrupt.

Once the OS Timer and its interrupts are enabled, the main program will start to execute the user tasks with their respective priority and in their given order.

Function Documentation

◆ sysOsTimer_Enable()

volatile uint16_t sysOsTimer_Enable ( volatile bool  interrupt_enable,
volatile uint8_t  interrupt_priority 
)

Definition at line 81 of file init_timer1.c.

◆ sysOsTimer_Initialize()

uint16_t sysOsTimer_Initialize ( void  )

Initializes the timer used as time-base for the task scheduler.

The internal PLL is set up to operate the CPU at maximum speed of 100 MIPS (100 MHz instruction cycle).

Returns
unsigned integer
0=failure
1=success

The task scheduler runs on a specific, usually fixed time base specified in the state machine section of the hardware abstraction layer (e.g. 100us). This routine initializes a device timer exclusively used for that purpose which is not shared with other tasks/peripherals to ensure stable, deterministic behavior of the firmware. The timer does not use interrupts. The scheduler task execution period is controlled by polling on the timer overrun bit, allowing some more relaxed timing while not putting additional burden on the CPU.

Definition at line 40 of file init_timer1.c.

+ Here is the caller graph for this function: