Bar Logo 4kW dsPIC33C PSFB DC-DC DA (Part-No. )
 
Content
     
Loading...
Searching...
No Matches
main_tasks.c
1//=======================================================================================================
2// @file main_tasks.c
3//
4// @brief contains the application specific tasks that are called regularly by the os_scheduler
5// two different timings priorities are available:
6// 1. 1ms Tasks called from the os_scheduler interrupt
7// the jitter that you will have in the 1ms realtime tasks called by the interrupt depends
8// on other interrupts that have a higher interrupt priority
9// 2. 1ms, 10ms, 100ms, 1s Tasks called from the main loop
10// these tasks are for soft realtime and not for hard realtime
11// so in average they are called with the required timing but the jitter can be very huge,
12// depending on the calls before.
13// use this for your non-timing critical application state machines
14//
15// @note you might consider to implement a watchdog and put the watchdog triggering into some Task
16//
17// @version v1.0
18// @date 2019-08-09
19// @author M52409
20//
21//=======================================================================================================
22
23#include <stdint.h>
24#include <stddef.h>
25#include <xc.h>
26
27#include "project_settings.h"
28#include "os/os_sys_time.h"
29#include "os/os_scheduler.h"
30
31#include "device/dev_led.h"
33#include "app/app_PBV_interface.h"
34//#include "device/dev_fan.h"
35#include "config/comms_config.h"
36
37static OS_SYSTIME_t sysTime;
38//=======================================================================================================
39//
40// put your application specific code in the following functions:
41// choose wisely between real-time and non-realtime!
42//
43// Interrupt Realtime Functions:
44// Tasks_Realtime_1ms : is called by the interrupt every ms - for time critical low jitter stuff
45//
46//
47// Mainloop Non-Realtime Functions:
48// Tasks_1ms : function is called by the main loop in average every 1ms
49// Tasks_10ms : function is called by the main loop in average every 10ms
50// Tasks_100ms : function is called by the main loop in average every 100ms
51// Tasks_1s : function is called by the main loop in average every second
52//
53// @note there could be some jitter here because it is not called directly by a timer interrupt
54// the timing in average is exact (keep in mind: in average), the jitter depends on the
55// called functions before
56//=======================================================================================================
57
58#if OS_USE_SCHEDULER_100us == 1
59//=======================================================================================================
60// @brief Tasks_Realtime_100us gets called directly from the timer interrupt every 100 �s
61// @note keep this routine as short as possible
62//=======================================================================================================
63/* The task functions would be written by the user who uses this scheduler in
64 the application. Hence 65 D is being excluded. */
65/* LDRA_EXCLUDE 65 D */
66void Tasks_Realtime_100us(void)
67{
68 // put your application specific code here that needs to be called every 100 micro seconds from the interrupt
69 // example: Drv_TestPin_Toggle(DBG_PIN1);
70
72
73}
74#endif /* OS_USE_SCHEDULER_100us */
75//=======================================================================================================
76// @brief Tasks_Realtime_1ms gets called directly from the timer interrupt every millisecond
77// @note keep this routine as short as possible
78//=======================================================================================================
79/* The task functions would be written by the user who uses this scheduler in
80 the application. Hence 65 D is being excluded. */
81/* LDRA_EXCLUDE 65 D */
82void Tasks_Realtime_1ms(void)
83{
84}
85
86#if OS_USE_SCHEDULER_100us == 1
87//=======================================================================================================
88// @brief Tasks_100us gets called every 100�s, put your things in it that need to be called regularly
89// @note there could be some jitter here because it is not called directly by a timer interrupt
90//=======================================================================================================
91/* LDRA_EXCLUDE 65 D */
92void Tasks_100us(void)
93{
95
96}
97#endif /* OS_USE_SCHEDULER_100us */
98//=======================================================================================================
99// @brief Tasks_1ms gets called every millisecond, put your things in it that need to be called regularly
100// @note there could be some jitter here because it is not called directly by a timer interrupt
101//=======================================================================================================
102/* LDRA_EXCLUDE 65 D */
103void Tasks_1ms(void)
104{
105// App_ExampleSomethingOne_1ms();
106// App_ExampleSomethingTwo_1ms();
107
108
109}
110
111//=======================================================================================================
112// @brief Tasks_10ms gets called every 10ms, put your things in it that need to be called regularly
113// @note there could be some jitter here because it is not called directly by a timer interrupt
114//=======================================================================================================
115/* LDRA_EXCLUDE 65 D */
116void Tasks_10ms(void)
117{
118 // put your application specific code here that needs to be called every 10 milliseconds
119 // App_Example_CheckButtons_1ms();
122
123}
124
125extern uint16_t os_resetCause;
126//=======================================================================================================
127// @brief Tasks_100ms gets called every 100 ms, put your things in it that need to be called regularly
128// @note there could be some jitter here because it is not called directly by a timer interrupt
129//=======================================================================================================
130void Tasks_100ms(void)
131{
132 Dev_LED_Task_100ms();
133}
134
135//=======================================================================================================
136// @brief Tasks_1s gets called every second, put your things in it that need to be called regularly
137// @note there could be some jitter here because it is not called directly by a timer interrupt
138//=======================================================================================================
139void Tasks_1s(void)
140{
141 // put your application specific code here that needs to be called every second
142 //OS_SysTime_GetTime(&sysTime);
144
145}
146
147//=======================================================================================================
148// @brief Tasks_Background gets called all the time when no other of the above tasks are being called
149// @note call this function when you want to implement your own timing or get code called as often
150// as possible. You can also put your timing variables into Tasks_Realtime_100us or
151// Tasks_Realtime_1ms. This way you get accurate timing variables that you can use here.
152//=======================================================================================================
153/* LDRA_EXCLUDE 65 D */
154void Tasks_Background(void)
155{
156 // put your application specific code here that needs to be called in the background.
157 // your application needs to take care of it's timing.
158
159
160}
app PBV psfb Frame map file Example
void app_PBV_Task_10ms()
task to be executed every 10ms
void app_PBV_Task_100us()
Task to be executed every 100 us.
void App_PBV_psfb_Task_1s(void)
1 second PBV task to be execution
void App_PBV_psfb_Task_10ms(void)
this is high frequency task to simulate sending of high frequency numeric data. Also to check if ther...
void PwrCtrl_Execute(void)
Executes the power control state machine.
Definition pwrctrl.c:73