First version under SVN is V4.0.1

This commit is contained in:
Richard Barry 2006-05-02 09:39:15 +00:00
parent 243393860c
commit b6df57c7e3
918 changed files with 269038 additions and 0 deletions

View file

@ -0,0 +1,557 @@
[F29746990]
x=0
y=122
[F10478061]
x=0
y=48
[F15207742]
x=0
y=48
[F20376480]
x=0
y=1332
[F29843090]
x=5
y=23
[F20121086]
x=0
y=84
[F29765107]
x=31
y=45
[F29843242]
x=13
y=8
[F20539803]
x=0
y=266
[F15568046]
x=1
y=293
[F20441499]
x=0
y=105
[F20558577]
x=0
y=4714
[F20528681]
x=0
y=44
[ProjectGroup]
nFiles=1
FileName0=Demo1.PC
[Project]
nFiles=3
UseAD=0
CompatOpts=0
AutoHead=
IdentifierPrint=0
TreePrint=0
StatementResultPrint=0
SourcePrint=0
spoPrint=0
AsmPrint=0
CaseSens=1
Optimise=45
AProcFreq=40000000
LOptBytes=16
LOptBytesReg=6
TopROM=32767
StackPointer=3839
HeapPointer=3584
HasDoneOptionDialog=1
ASMProcessor=18F4620
UseLinker=0
DEBUGADV=1
Column0=-1
Column1=-1
Column2=259
TabIndex=0
ShowIcons=0
WindowState=0
Top=418
Left=0
Width=339
Height=209
FileType0_Name=main.c
FileType0_FileType=0
FileType0_DoLast=0
FileType1_Name=interrupt.c
FileType1_FileType=0
FileType1_DoLast=0
FileType2_Name=fuses.c
FileType2_FileType=0
FileType2_DoLast=0
[Debug]
WindowState=0
Top=0
Left=679
Width=338
Height=626
WinNumberIsIndex0=4097
WinNumberIsIndex1=4096
WinNumberIsIndex2=12
WinNumberIsIndex3=9
WinNumberIsIndex4=8
WinNumberIsIndex5=7
WinNumberIsIndex6=5
WinNumberIsIndex7=4
WinNumberIsIndex8=3
WinNumberIsIndex9=2
WinNumberIsIndex10=1
WinNumberIsIndex11=11
WinNumberIsIndex12=0
nWin=13
HType=0
HFreq=19
ScenixTurbo=1
Watchdog=0
LocalVariables=0
DBPort=3970
DBBit=3
UseICD=0
AutoSet=1
DBVars=3824
DBRate=57600
DBSerPort=4
UsePICKey=2
nTabs=4
Tab0=Main
Tab1=Memory
Tab2=Special
Tab3=History
[Window4097]
aHeight=0
aWidth=0
Height=121
Width=200
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=10
y=427
Left=43
Top=264
Group=0
Page=-1
[ExtDev4097]
Type=2
TypeN=Terminal
Pars0=7
Name=Terminal
FileName=
Layer=0
Ports0=0
Bit0=3
ConLev0=-1
Ports1=0
Bit1=2
ConLev1=-1
Pars1=0
Pars2=0
[Window4096]
aHeight=0
aWidth=0
Height=200
Width=90
isMinimised=0
isVisible=1
ShowBorder=0
ShowCaption=0
Sizeable=0
x=10
y=299
Left=43
Top=131
Group=0
Page=-1
[ExtDev4096]
Type=12
TypeN=Pin Out
Ports0=0
Bit0=3
ConLev0=-1
Ports1=0
Bit1=2
ConLev1=-1
Pars0=0
Pars1=0
Pars2=0
Name=Pin Out : 18F4620
FileName=
Layer=1
[Window12]
aHeight=274
aWidth=732
Height=141
Width=366
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=0
y=38
Left=0
Top=100
Group=0
Page=1
[Window9]
aHeight=250
aWidth=250
Height=247
Width=231
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=0
x=98
y=133
Left=32
Top=149
Group=0
Page=15
[Window8]
aHeight=250
aWidth=250
Height=266
Width=283
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=139
y=105
Left=45
Top=135
Group=0
Page=8
[Window7]
aHeight=947
aWidth=978
Height=490
Width=489
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=16
y=45
Left=8
Top=104
Group=0
Page=3
[Window5]
aHeight=955
aWidth=490
Height=494
Width=161
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=504
y=42
Left=166
Top=102
Group=0
Page=2
[Window4]
aHeight=957
aWidth=498
Height=495
Width=164
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=2
y=40
Left=0
Top=101
Group=0
Page=2
[Window3]
aHeight=191
aWidth=985
Height=98
Width=325
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=0
y=666
Left=0
Top=425
Group=0
Page=7
[Window2]
aHeight=1000
aWidth=538
Height=518
Width=177
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=462
y=0
Left=152
Top=81
Group=0
Page=4
[Window1]
aHeight=277
aWidth=998
Height=143
Width=329
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=0
y=720
Left=0
Top=453
Group=0
Page=1
[Window11]
aHeight=335
aWidth=560
Height=173
Width=184
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=436
y=517
Left=143
Top=348
Group=0
Page=9
[Window0]
aHeight=472
aWidth=558
Height=244
Width=184
isMinimised=1
isVisible=1
ShowBorder=1
ShowCaption=1
Sizeable=1
x=438
y=42
Left=144
Top=102
Group=0
Page=1
[APPWIZ]
AProcFreq=4000000
nUserTemp=0
Proc=16F84
Left=-118
Top=-5780
Width=750
Heigth=600
nElem=0
[GLOBAL]
LoadCheck=2
SimulateAll=1
[MainWindow]
WindowState=2
Top=-4
Left=-4
Width=1032
Height=748
Update=25000
StopOnError=1
[FindRep]
nTextFind=1
nTextReplace=0
TextFind0=idle
[EditWindow]
Tab=0
nFiles=1
nMRU=9
MarginOn=1
MarginType=2
WindowState=0
Top=0
Left=0
Width=679
Height=418
Files0=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo1\main.c
MRU0=C:\DOCUMENTS AND SETTINGS\marcel\MY DOCUMENTS\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WIZC\Demo1\main.c
Files1=C:\PROGRA~1\FED\PIXIE\Libs\LibCore\Bit16.asm
Files2=C:\DOCUMENTS AND SETTINGS\marcel\MY DOCUMENTS\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WIZC\Demo1\main.c
MRU1=C:\PROGRA~1\FED\PIXIE\Libs\LibCore\Bit16.asm
MRU2=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo1\Demo1.rep
Files3=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo1\Demo1.rep
Files4=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo1\interrupt.c
MRU3=C:\PROGRAM FILES\FED\PIXIE\Libs\LibsUser\LIBFREERTOS\Modules\Tasks.c
MRU4=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo1\interrupt.c
Files5=C:\PROGRAM FILES\FED\PIXIE\Libs\LibsUser\LIBFREERTOS\Modules\Tasks.c
Files6=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo1\fuses.c
MRU5=C:\Program Files\FED\PIXIE\Libs\LibCore\Bit16.asm
MRU6=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo1\fuses.c
MRU7=C:\Program Files\FED\PIXIE\Libs\LibsUser\libFreeRTOS\Include\portmacro.h
MRU8=C:\Documents and Settings\marcel\My Documents\pic\FreeRTOS\FreeRTOS\Demo\PIC18_WizC\Demo1\FreeRTOSConfig.h
[PinConnections]
nPins=0
[AssCode]
ProcType=18F4620
[Information]
Column0=-1
Column1=8
Column2=4
Column3=16
Column4=-1
Column5=50
MemoHeight=154
WindowState=0
Top=418
Left=339
Width=339
Height=209
[F29011525]
x=0
y=146
[F28396641]
x=10
y=6
[F29564798]
x=30
y=28
[F29012037]
x=0
y=115
[F28429921]
x=0
y=0
[F29011781]
x=0
y=118
[F29216334]
x=0
y=189
[F28413281]
x=0
y=0
[F30088746]
x=1
y=77
[F30162974]
x=31
y=41
[F29012805]
x=0
y=111
[F30164254]
x=33
y=61
[F29566078]
x=0
y=0
[F28479841]
x=0
y=51
[F30090026]
x=43
y=55
[F29453097]
x=56
y=205
[F29217358]
x=0
y=141
[F20258362]
x=0
y=5698
[F30827659]
x=0
y=4965
[F30243933]
x=0
y=4821
[F20414028]
x=0
y=6113
[F30146592]
x=0
y=75
[F20220814]
x=0
y=534
[F30427679]
x=0
y=46
[F30394911]
x=0
y=0
[F29013061]
x=0
y=113
[F27259933]
x=0
y=37
[F27123467]
x=0
y=193
[F30360431]
x=0
y=4767
[F28496481]
x=8
y=29
[F19387162]
x=0
y=3
[F19809996]
x=22
y=3
[F18298596]
x=0
y=0
[F28396679]
x=0
y=0
[F28930696]
x=0
y=49
[F16522402]
x=0
y=11
[F18298558]
x=6
y=16
[F25371223]
x=7
y=1
[F30161512]
x=0
y=0
[F16524734]
x=0
y=5
[F18599386]
x=0
y=0
[F14954382]
x=0
y=29
[F16904974]
x=0
y=0

View file

@ -0,0 +1,82 @@
/*
FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation.
***************************************************************************
*/
/*
Changes from V3.0.0
+ TickRate reduced to 250Hz.
+ configIDLE_SHOULD_YIELD added.
Changes from V3.0.1
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*----------------------------------------------------------*/
#define configUSE_PREEMPTION ( 1 )
#define configUSE_IDLE_HOOK ( 0 )
#define configUSE_TICK_HOOK ( 0 )
#define configTICK_RATE_HZ ( 250 )
#define configMAX_PRIORITIES ( 1 )
#define configMINIMAL_STACK_SIZE portMINIMAL_STACK_SIZE
#define configMAX_TASK_NAME_LEN ( 3 )
#define configUSE_TRACE_FACILITY ( 0 )
#define configUSE_16_BIT_TICKS ( 1 )
#define configIDLE_SHOULD_YIELD ( 1 )
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Set the following definitions to 1 to include the component, or zero
to exclude the component. */
/* Include/exclude the stated API function. */
#define INCLUDE_vTaskPrioritySet ( 0 )
#define INCLUDE_uxTaskPriorityGet ( 0 )
#define INCLUDE_vTaskDelete ( 0 )
#define INCLUDE_vTaskCleanUpResources ( 0 )
#define INCLUDE_vTaskSuspend ( 0 )
#define INCLUDE_vTaskDelayUntil ( 1 )
#define INCLUDE_vTaskDelay ( 0 )
#endif /* FREERTOS_CONFIG_H */

View file

@ -0,0 +1,41 @@
#ifndef _MALLOC_SETTINGS_H
#define _MALLOC_SETTINGS_H
/*********************************************************************
** Title: Dynamic memory (de-)allocation library for wizC.
**
** Author: Marcel van Lieshout
**
** Copyright: (c) 2005, HMCS, Marcel van Lieshout
**
** License: This software is released to the public domain and comes
** without warranty and/or guarantees of any kind. You have
** the right to use, copy, modify and/or (re-)distribute the
** software as long as the reference to the author is
** maintained in the software and a reference to the author
** is included in any documentation of each product in which
** this library (in it's original or in a modified form)
** is used.
*********************************************************************/
/*********************************************************************
** The model to use
*********************************************************************/
//#define MALLOC_SMALL
#define MALLOC_LARGE
/*********************************************************************
** The size of the heap
*********************************************************************/
#define MALLOC_HEAP_SIZE (3200)
/*********************************************************************
** Should released memory be scribbled with 0x55 before releasing it?
*********************************************************************/
//#define MALLOC_SCRIBBLE
/********************************************************************
** Enable Debug-mode?
*********************************************************************/
//#define MALLOC_DEBUG
#endif /* _MALLOC_SETTINGS_H */

View file

@ -0,0 +1,50 @@
/*
FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation.
***************************************************************************
*/
/*
Changes from V3.0.0
+ Several modules predefined to avoid linker problems
Changes from V3.0.1
*/
#ifndef _memcpy
#define _memcpy 1
#endif
#ifndef _memset
#define _memset 1
#endif
#ifndef _strncpy
#define _strncpy 1
#endif

View file

@ -0,0 +1,58 @@
/*
FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation.
***************************************************************************
*/
/*
Changes from V3.0.0
Changes from V3.0.1
*/
/*
** Here are the configuration words set. See the PIC datasheet
** and the wizC manual for an explanation
*/
#include <pic.h>
/*
** These fuses are for PIC18F4620
*/
#pragma __config _CONFIG1H,_IESO_OFF_1H & _FCMEN_OFF_1H & _OSC_HSPLL_1H
#pragma __config _CONFIG2L,_BORV_21_2L & _BOREN_SBORDIS_2L & _PWRT_ON_2L
#pragma __config _CONFIG2H,_WDTPS_32768_2H & _WDT_OFF_2H
#pragma __config _CONFIG3H,_MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_PORTC_3H
#pragma __config _CONFIG4L,_DEBUG_OFF_4L & _XINST_OFF_4L & _LVP_OFF_4L & _STVREN_OFF_4L
#pragma __config _CONFIG5L,_CP3_OFF_5L & _CP2_OFF_5L & _CP1_OFF_5L & _CP0_OFF_5L
#pragma __config _CONFIG5H,_CPD_OFF_5H & _CPB_OFF_5H
#pragma __config _CONFIG6L,_WRT3_OFF_6L & _WRT2_OFF_6L & _WRT1_OFF_6L & _WRT0_OFF_6L
#pragma __config _CONFIG6H,_WRTD_OFF_6H & _WRTB_OFF_6H & _WRTC_OFF_6H
#pragma __config _CONFIG7L,_EBTR3_OFF_7L & _EBTR2_OFF_7L & _EBTR1_OFF_7L & _EBTR0_OFF_7L
#pragma __config _CONFIG7H,_EBTRB_OFF_7H

View file

@ -0,0 +1,109 @@
/*
FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation.
***************************************************************************
*/
/*
Changes from V3.0.0
+ Added functionality to only call vTaskSwitchContext() once
when handling multiple interruptsources in a single interruptcall.
+ Included Filenames changed to a .c extension to allow stepping through
code using F7.
Changes from V3.0.1
*/
#include <pic.h>
/* Scheduler include files. */
#include <FreeRTOS.h>
#include <task.h>
#include <queue.h>
static bit uxSwitchRequested;
/*
* Vector for the ISR.
*/
void pointed Interrupt()
{
/*
* Save the context of the current task.
*/
portSAVE_CONTEXT( portINTERRUPTS_FORCED );
/*
* No contextswitch requested yet
*/
uxSwitchRequested = pdFALSE;
/*
* Was the interrupt the FreeRTOS SystemTick?
*/
#include <libFreeRTOS/Drivers/Tick/isrTick.c>
/*******************************************************************************
** DO NOT MODIFY ANYTHING ABOVE THIS LINE
********************************************************************************
** Enter the includes for the ISR-code of the FreeRTOS drivers below.
**
** You cannot use local variables. Alternatives are:
** - Use static variables (Global RAM usage increases)
** - Call a function (Additional cycles are needed)
** - Use unused SFR's (preferred, no additional overhead)
** See "../Serial/isrSerialTx.c" for an example of this last option
*******************************************************************************/
/*******************************************************************************
** DO NOT MODIFY ANYTHING BELOW THIS LINE
*******************************************************************************/
/*
* Was a contextswitch requested by one of the
* interrupthandlers?
*/
if ( uxSwitchRequested )
{
vTaskSwitchContext();
}
/*
* Restore the context of the (possibly other) task.
*/
portRESTORE_CONTEXT();
#pragma asmline retfie 0
}

View file

@ -0,0 +1,202 @@
/*
FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
See http://www.FreeRTOS.org for documentation, latest information, license
and contact details. Please ensure to read the configuration and relevant
port sections of the online documentation.
***************************************************************************
*/
/*
Changes from V3.0.0
Changes from V3.0.1
*/
/*
* Instead of the normal single demo application, the PIC18F demo is split
* into several smaller programs of which this is the first. This enables the
* demo's to be executed on the RAM limited PIC-devices.
*
* The Demo1 project is configured for a PIC18F4620 device. Main.c starts 9
* tasks (including the idle task).
* This first demo is included to do a quick check on the FreeRTOS
* installation. It is also included to demonstrate a minimal project-setup
* to use FreeRTOS in a wizC environment.
*
* Eight independant tasks are created. All tasks share the same taskcode.
* Each task blinks a different led on portB. The blinkrate for each task
* is different, but chosen in such a way that portB will show a binary
* counter pattern. All blinkrates are derived from a single master-rate.
* By default, this masterrate is set to 100 milliseconds. Although such
* a low value will make it almost impossible to see some of the leds
* actually blink, it is a good value when using the wizC-simulator.
* When testing on a real chip, changing the value to eg. 500 milliseconds
* would be appropiate.
*/
/* Scheduler include files. */
#include <FreeRTOS.h>
#include <task.h>
#define mainBLINK_LED_INTERVAL ( ( portTickType ) 100 / ( portTICK_RATE_MS ) )
/* The LED that is flashed by the B0 task. */
#define mainBLINK_LED0_PORT LATD
#define mainBLINK_LED0_TRIS TRISD
#define mainBLINK_LED0_PIN 0
#define mainBLINK_LED0_INTERVAL ((mainBLINK_LED_INTERVAL) << (mainBLINK_LED0_PIN))
/* The LED that is flashed by the B1 task. */
#define mainBLINK_LED1_PORT LATD
#define mainBLINK_LED1_TRIS TRISD
#define mainBLINK_LED1_PIN 1
#define mainBLINK_LED1_INTERVAL ((mainBLINK_LED_INTERVAL) << (mainBLINK_LED1_PIN))
/* The LED that is flashed by the B2 task. */
#define mainBLINK_LED2_PORT LATD
#define mainBLINK_LED2_TRIS TRISD
#define mainBLINK_LED2_PIN 2
#define mainBLINK_LED2_INTERVAL ((mainBLINK_LED_INTERVAL) << (mainBLINK_LED2_PIN))
/* The LED that is flashed by the B3 task. */
#define mainBLINK_LED3_PORT LATD
#define mainBLINK_LED3_TRIS TRISD
#define mainBLINK_LED3_PIN 3
#define mainBLINK_LED3_INTERVAL ((mainBLINK_LED_INTERVAL) << (mainBLINK_LED3_PIN))
/* The LED that is flashed by the B4 task. */
#define mainBLINK_LED4_PORT LATD
#define mainBLINK_LED4_TRIS TRISD
#define mainBLINK_LED4_PIN 4
#define mainBLINK_LED4_INTERVAL ((mainBLINK_LED_INTERVAL) << (mainBLINK_LED4_PIN))
/* The LED that is flashed by the B5 task. */
#define mainBLINK_LED5_PORT LATD
#define mainBLINK_LED5_TRIS TRISD
#define mainBLINK_LED5_PIN 5
#define mainBLINK_LED5_INTERVAL ((mainBLINK_LED_INTERVAL) << (mainBLINK_LED5_PIN))
/* The LED that is flashed by the B6 task. */
#define mainBLINK_LED6_PORT LATD
#define mainBLINK_LED6_TRIS TRISD
#define mainBLINK_LED6_PIN 6
#define mainBLINK_LED6_INTERVAL ((mainBLINK_LED_INTERVAL) << (mainBLINK_LED6_PIN))
/* The LED that is flashed by the B7 task. */
#define mainBLINK_LED7_PORT LATD
#define mainBLINK_LED7_TRIS TRISD
#define mainBLINK_LED7_PIN 7
#define mainBLINK_LED7_INTERVAL ((mainBLINK_LED_INTERVAL) << (mainBLINK_LED7_PIN))
typedef struct {
unsigned char *port;
unsigned char *tris;
unsigned char pin;
portTickType interval;
} SBLINK;
const SBLINK sled0 = {&mainBLINK_LED0_PORT, &mainBLINK_LED0_TRIS, mainBLINK_LED0_PIN, mainBLINK_LED0_INTERVAL};
const SBLINK sled1 = {&mainBLINK_LED1_PORT, &mainBLINK_LED1_TRIS, mainBLINK_LED1_PIN, mainBLINK_LED1_INTERVAL};
const SBLINK sled2 = {&mainBLINK_LED2_PORT, &mainBLINK_LED2_TRIS, mainBLINK_LED2_PIN, mainBLINK_LED2_INTERVAL};
const SBLINK sled3 = {&mainBLINK_LED3_PORT, &mainBLINK_LED3_TRIS, mainBLINK_LED3_PIN, mainBLINK_LED3_INTERVAL};
const SBLINK sled4 = {&mainBLINK_LED4_PORT, &mainBLINK_LED4_TRIS, mainBLINK_LED4_PIN, mainBLINK_LED4_INTERVAL};
const SBLINK sled5 = {&mainBLINK_LED5_PORT, &mainBLINK_LED5_TRIS, mainBLINK_LED5_PIN, mainBLINK_LED5_INTERVAL};
const SBLINK sled6 = {&mainBLINK_LED6_PORT, &mainBLINK_LED6_TRIS, mainBLINK_LED6_PIN, mainBLINK_LED6_INTERVAL};
const SBLINK sled7 = {&mainBLINK_LED7_PORT, &mainBLINK_LED7_TRIS, mainBLINK_LED7_PIN, mainBLINK_LED7_INTERVAL};
/*
* The task code for the "vBlink" task.
*/
static portTASK_FUNCTION_PROTO(vBlink, pvParameters);
/*-----------------------------------------------------------*/
/*
* Creates the tasks, then starts the scheduler.
*/
void main( void )
{
/*
* Start the blink tasks defined in this file.
*/
xTaskCreate( vBlink, "B0", configMINIMAL_STACK_SIZE, &sled0, tskIDLE_PRIORITY, NULL );
xTaskCreate( vBlink, "B1", configMINIMAL_STACK_SIZE, &sled1, tskIDLE_PRIORITY, NULL );
xTaskCreate( vBlink, "B2", configMINIMAL_STACK_SIZE, &sled2, tskIDLE_PRIORITY, NULL );
xTaskCreate( vBlink, "B3", configMINIMAL_STACK_SIZE, &sled3, tskIDLE_PRIORITY, NULL );
xTaskCreate( vBlink, "B4", configMINIMAL_STACK_SIZE, &sled4, tskIDLE_PRIORITY, NULL );
xTaskCreate( vBlink, "B5", configMINIMAL_STACK_SIZE, &sled5, tskIDLE_PRIORITY, NULL );
xTaskCreate( vBlink, "B6", configMINIMAL_STACK_SIZE, &sled6, tskIDLE_PRIORITY, NULL );
xTaskCreate( vBlink, "B7", configMINIMAL_STACK_SIZE, &sled7, tskIDLE_PRIORITY, NULL );
/*
* Start the scheduler.
*/
vTaskStartScheduler( );
while(1) /* This point should never be reached. */
{
}
}
/*-----------------------------------------------------------*/
static portTASK_FUNCTION(vBlink, pvParameters)
{
unsigned char *Port = ((SBLINK *)pvParameters)->port;
unsigned char *Tris = ((SBLINK *)pvParameters)->tris;
unsigned char Pin = ((SBLINK *)pvParameters)->pin;
portTickType Interval = ((SBLINK *)pvParameters)->interval;
portTickType xLastWakeTime;
/*
* Initialize the hardware
*/
*Tris &= ~(1<<Pin); // Set the pin that is used by this task to ouput
*Port &= ~(1<<Pin); // Drive the pin low
/*
* Initialise the xLastWakeTime variable with the current time.
*/
xLastWakeTime = xTaskGetTickCount();
/*
* Cycle for ever, delaying then toggle the LED.
*/
for( ;; )
{
/*
* Wait until it is time to toggle
*/
vTaskDelayUntil( &xLastWakeTime, Interval );
/*
* Toggle the LED for visual feedback.
*/
*Port ^= 1<<Pin;
}
}