#include <stdio.h> /* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" #include "queue.h" #include "croutine.h" /* Demo application includes. */ #include "partest.h" // Select Internal FRC at POR _FOSCSEL(FNOSC_FRC); // Enable Clock Switching and Configure _FOSC(FCKSM_CSECMD & OSCIOFNC_OFF); // FRC + PLL //_FOSC(FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_XT); // XT + PLL _FWDT(FWDTEN_OFF); // Watchdog Timer Enabled/disabled by user software static void prvSetupHardware( void ); xTaskHandle hTask3 = NULL; void Task1(void *params) { for (;;) { _RB15 = ~_RB15; //comutare LED-ul 15 vTaskDelay(2500); // 2.5 secunde // Suspendă T3 după 10 secunde și îl reactivează după 15 secunde if (xTaskGetTickCount()>=(10000)) { vTaskSuspend(hTask3); // Suspendă T3 } if (xTaskGetTickCount() >= (15000)) { vTaskResume(hTask3); // Reia T3 } } } void Task2(void *params) { for (;;) { _RB12 = ~_RB12; // Comută LED-ul 12 vTaskDelay(500); // 0.5 secunde // Creează T3 după 4 secunde de la pornirea aplicației if ((xTaskGetTickCount() >= 4000) && (hTask3 == NULL)) { xTaskCreate(Task3,(signed portCHAR *) "Ts3", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, &hTask3); } } } void Task3(void *params) { for (;;) { _RB13 =~ _RB13; vTaskDelay(1000); } } int main( void ) { /* Configure any hardware required for this demo. */ prvSetupHardware(); xTaskCreate(Task1, (signed portCHAR *) "Ts1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL); xTaskCreate(Task2, (signed portCHAR *) "Ts2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 3, NULL); /* Finally start the scheduler. */ vTaskStartScheduler(); return 0; } /*-----------------------------------------------------------*/ void initPLL(void) { // Configure PLL prescaler, PLL postscaler, PLL divisor PLLFBD = 41; // M = 43 FRC //PLLFBD = 30; // M = 32 XT CLKDIVbits.PLLPOST=0; // N1 = 2 CLKDIVbits.PLLPRE=0; // N2 = 2 // Initiate Clock Switch to Internal FRC with PLL (NOSC = 0b001) __builtin_write_OSCCONH(0x01); // FRC //__builtin_write_OSCCONH(0x03); // XT __builtin_write_OSCCONL(0x01); // Wait for Clock switch to occur while (OSCCONbits.COSC != 0b001); // FRC //while (OSCCONbits.COSC != 0b011); // XT // Wait for PLL to lock while(OSCCONbits.LOCK!=1) {}; } static void prvSetupHardware( void ) { //ADPCFG = 0xFFFF; //make ADC pins all digital - adaugat vParTestInitialise(); initPLL(); }
Standard input is empty
#include <stdio.h> /* Scheduler includes. */ #include "FreeRTOS.h" #include "task.h" #include "queue.h" #include "croutine.h" /* Demo application includes. */ #include "partest.h" // Select Internal FRC at POR _FOSCSEL(FNOSC_FRC); // Enable Clock Switching and Configure _FOSC(FCKSM_CSECMD & OSCIOFNC_OFF); // FRC + PLL //_FOSC(FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_XT); // XT + PLL _FWDT(FWDTEN_OFF); // Watchdog Timer Enabled/disabled by user software static void prvSetupHardware( void ); xTaskHandle hTask3 = NULL; void Task1(void *params) { for (;;) { _RB15 = ~_RB15; //comutare LED-ul 15 vTaskDelay(2500); // 2.5 secunde // Suspendă T3 după 10 secunde și îl reactivează după 15 secunde if (xTaskGetTickCount()>=(10000)) { vTaskSuspend(hTask3); // Suspendă T3 } if (xTaskGetTickCount() >= (15000)) { vTaskResume(hTask3); // Reia T3 } } } void Task2(void *params) { for (;;) { _RB12 = ~_RB12; // Comută LED-ul 12 vTaskDelay(500); // 0.5 secunde // Creează T3 după 4 secunde de la pornirea aplicației if ((xTaskGetTickCount() >= 4000) && (hTask3 == NULL)) { xTaskCreate(Task3,(signed portCHAR *) "Ts3", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, &hTask3); } } } void Task3(void *params) { for (;;) { _RB13 =~ _RB13; vTaskDelay(1000); } } int main( void ) { /* Configure any hardware required for this demo. */ prvSetupHardware(); xTaskCreate(Task1, (signed portCHAR *) "Ts1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL); xTaskCreate(Task2, (signed portCHAR *) "Ts2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 3, NULL); /* Finally start the scheduler. */ vTaskStartScheduler(); return 0; } /*-----------------------------------------------------------*/ void initPLL(void) { // Configure PLL prescaler, PLL postscaler, PLL divisor PLLFBD = 41; // M = 43 FRC //PLLFBD = 30; // M = 32 XT CLKDIVbits.PLLPOST=0; // N1 = 2 CLKDIVbits.PLLPRE=0; // N2 = 2 // Initiate Clock Switch to Internal FRC with PLL (NOSC = 0b001) __builtin_write_OSCCONH(0x01); // FRC //__builtin_write_OSCCONH(0x03); // XT __builtin_write_OSCCONL(0x01); // Wait for Clock switch to occur while (OSCCONbits.COSC != 0b001); // FRC //while (OSCCONbits.COSC != 0b011); // XT // Wait for PLL to lock while(OSCCONbits.LOCK!=1) {}; } static void prvSetupHardware( void ) { //ADPCFG = 0xFFFF; //make ADC pins all digital - adaugat vParTestInitialise(); initPLL(); }