balace wrote on Monday, November 21, 2011:
Thanks for the quick reply Mr Barry, I am using vTaskDelayUntil, though I also tried with vTaskDelay and it still did not work.
Below are the tasks and some changes I made in the makefile of ATmega323 to suit ATmega32
NB: I am using an STK500 board
****************************************************************************************************
Task A:
void taskA(void *pV)
{
char *name;
name = (char*)pV;
portTickType xLastWakeTime;
xLastWakeTime = xTaskGetTickCount();
DDRA = 0x00; // 8 Switches are connected to this port but are not used for this task
DDRC = 0xFF; // Eight LEDs are connected to this port
for(;
{
//TODO:: Please write your application code
PORTC = 0xFF;
vTaskDelayUntil(250/portTICK_RATE_MS);
}
}
****************************************************************************************************
Task B:
void taskB(void *pV)
{
char *name;
name = (char*)pV;
portTickType xLastWakeTime;
xLastWakeTime = xTaskGetTickCount();
for(;
{
//TODO:: Please write your application code
PORTC = 0xFF;
vTaskDelayUntil(250/portTICK_RATE_MS); // 250ms Delay
}
}
****************************************************************************************************
Main File:
#include <avr/io.h>
#include <util/delay.h>
#include “FreeRTOS.h”
#include “list.h”
#include “task.h”
#include “queue.h”
#include “croutine.h”
#include “timers.h”
#include “FreeRTOSConfig.h”
#include “taskA.h”
#include “taskB.h”
#include <avr/portpins.h>
#include “portable.h”
#include “timers.h”
int main(void)
{
DDRA = 0x00; // set port A as Input (switches are connected to this port)
DDRC = 0xFF; // set port B as Output (LEDs are connected to this port)
const signed char *Task_A= (const signed char *)(“My_TaskA”);
const signed char *Task_B= (const signed char *)(“my_TaskB”);
xTaskCreate(taskB, Task_A, 1000, NULL, 2, NULL ); // creates TaskB
xTaskCreate(taskA, Task_B, 1000, NULL, 2, NULL ); // creates TaskA
vTaskStartScheduler(); // starts the Task Scheduler
for( ;; );
}
****************************************************************************************************
For the make file, the demo files were commented out and my files included. As seen below, the target and MCU name was changed amongst others. What ever is not shown here means it wasn’t altered and remains thesame for ATmega323 demo.
Makefile:
F_CPU = 8000000
# MCU name
MCU = atmega32
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = AVR32PROJECT
# Optimization level, can be . 0 turns off optimization.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = 0
# List C source files here. (C dependencies are automatically generated.)
DEMO_DIR = …/Common/Minimal
SOURCE_DIR = …/…/Source
PORT_DIR = …/…/Source/portable/GCC/ATMega32
SRC = \
AVR32PROJECT.c \
taskA.c \
taskB.c \
$(SOURCE_DIR)/tasks.c \
$(SOURCE_DIR)/queue.c \
$(SOURCE_DIR)/list.c \
$(SOURCE_DIR)/croutine.c \
$(SOURCE_DIR)/timers.c \
$(SOURCE_DIR)/portable/MemMang/heap_1.c \
$(PORT_DIR)/port.c
#$(DEMO_DIR)/crflash.c \
#$(DEMO_DIR)/integer.c \
#$(DEMO_DIR)/PollQ.c \
#$(DEMO_DIR)/comtest.c
#main.c \
#ParTest/ParTest.c \
#serial/serial.c \
#regtest.c \
AVRDUDE_PROGRAMMER = stk500
Thanks and I gladly await your support