Porting μC/OS-II to a PIC Microcontrolle
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
seminar class
Active In SP

Posts: 5,361
Joined: Feb 2011
18-02-2011, 12:21 PM

.pdf   report.pdf (Size: 162.93 KB / Downloads: 93)
Porting μC/OS-II to a PIC Microcontroller
1. Project Idea
Microchip’s 8-bit low-cost PIC microcontrollers feature a powerful architecture, flexiblememory technologies, and comprehensive easy-to-use development tools [1]. The authorhas used PIC microcontrollers many times and is still fascinated by the simplicity of theirarchitecture and instruction set.Porting μC/OS-II to a PIC microcontroller is the first goal of this project and implimentation. The μC/OS-IIwebsite [2] indicates that there is a possibility to port μC/OS-II to the PIC18Fmicrocontroller family.For convenience reasons, a software simulator (Virtual Breadboard) for emulating somepopular PIC microcontrollers without using any hardware will be used. Also, there is a freestudent version of the C-compiler that is tailored for the PIC18F family.After porting μC/OS-II, the ultimate goal of this project and implimentation is to create, run, and manageseveral independent tasks with different priorities in μC/OS-II on a PIC. The tasks will besimple counters and their progress will be observed on a display.
1.1 Approaches
There are two possible approaches for completing this project and implimentation:
•Set up the hardware exclusively with virtual components in Virtual Breadboard.
•Set up the hardware on a real breadboard with real components.If possible the first approach will be used. If there are any problems with the first approach,the second approach is an equally good but more time-consuming backup solution.
1.2 Hardware Requirements
Following the first approach, no actual hardware is needed. The PIC microcontroller and allperipheral components can be simulated using Virtual Breadboard.However, for the PIC18F family and especially Virtual Breadboard, the code for μC/OS-II isquite sophisticated. Therefore, there is the possibility that the simulator will not be able toprocess μC/OS-II correctly. If this should happen, the hardware will be built on a realbreadboard using real components according to the second approach. The details will bediscussed in a later chapter.
1.3 Software Requirements
The following software packages will be used:
•Embedded OS: μC/OS-II
•C-compiler: MPLAB C18 v3.02 Student Edition [1]
•Assembler: MPLAB IDE v7.40 [1]
•PIC simulator: Virtual Breadboard [3]
2. Approach 1: Running μC/OS-II in Virtual Breadboard
Following the first approach, the goal is to get the basic μC/OS-II port running in VirtualBreadboard. The steps for reaching this goal are described in the following chapters.
2.1 Choosing the Target System
The first decision that had to be made was the selection of the actual microcontroller withinthe PIC18F family. The PIC18F452 [4] is one of the most widely used microcontrollers inthis particular family and support for most of the problems that might occur can be found onthe Internet. It is also implemented in the Virtual Breadboard simulator. Therefore, μC/OS-IIwill be ported to the PIC18F452 microcontroller.
2.2 Getting the μC/OS-II Code
The standard μC/OS-II code was obtained from the CD that comes with the book by JeanJ. Labrosse [5]. There is a link on [2] pointing to [6]. This website contains a personalproject and implimentation executed by Nathan Brown, in which he wrote a PIC18F family port code forμC/OS-II. However, his code is from 2002 and is not quite compatible with the new versionof the MPLAB C18 compiler (v3.02). Nevertheless, his code is available free of charge and will be used as a basis for further development steps.
2.3 Compiling μC/OS-II with MPLAB for the PIC18F452
Table 2-1 shows an overview of all the files needed for compiling. The links among the files is shown in Figure 2-1. After understanding the purpose of each file and the different links among them, a project and implimentation structure in MPLAB has been created (see Figure 2-2). Most of the C- and H-files are part of the μC/OS-II kernel and some of them have not been changed at all.The test.c file contains a simple test function to verify the correct execution of μC/OS-II. It activates a 4-bit counter that counts from 0 to 9 in an endless loop. The counter outputs are directed to PORTD of the PIC and the counting can be observed on a 7-segment display.The details of the other files can be seen in Table 2-1.Some compiler settings tips are posted on Nathan Brown’s website [6]. Additionally, heclaims that the libraries that come with MPLAB C18 have to be recompiled with the multibank stack model enabled. As far as the author knows, the libraries of the current MPLAB C18 version already have this feature enabled. Therefore, nothing has to be done in this matter.
2.3.1 Compiling Problems
Compiling the combination of original and ported code files generated a number of errorswhich had to be resolved first.•Some labels for floating point operations were out of date•The path for included code files was incorrect•Include, library, and linker paths were incorrectAfter resolving the problems, the project and implimentation has successfully been compiled.
2.4 Virtual Breadboard Simulator
Virtual Breadboard [3] can be used to simulate hardware setups without using any actualhardware. At this point, it is used to visualize the correct function of μC/OS-II.After the hex-code generated by the MPLAB C18 compiler is loaded into the virtualPIC18F452, the simulation can be started.Figure 2-3 shows the setup for testing the first running task (the counter described inchapter 2.3) in μC/OS-II. PORTD of the PIC18F452 feeds a 7-segment driver (the chiplabeled 4511), which is connected to the 7-segment display.
2.4.1 Virtual Breadboard Problems
Unfortunately, the new version 1.6 of Virtual Breadboard, which supports microcontrollersfrom the PIC18F family for the first time, has still some bugs:
•Start-up problems with the compiled code
•Wait function (for loop) is not working
•Microcontroller flags may be faulty
The first problem has been resolved by the Virtual Breadboard developer, the second andthe third could not be resolved so far. Another more serious problem is that the μC/OS-IIfunction OSStart(), which starts the counting task in the multitask environment, is notworking. This might have something to do with the other Virtual Breadboard bugs, but itmay also be another problem. If the counting task is called in a foreground/backgroundenvironment, it works fine.At this point, the author decided to use a real breadboard to set up the hardware instead ofVirtual Breadboard.

Important Note..!

If you are not satisfied with above reply ,..Please


So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page

Quick Reply
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  Noise Characterization of A/D Converter on PIC Microcontroller PPT study tips 0 323 05-06-2013, 12:28 PM
Last Post: study tips
  PIC 16F877A Tutorials for Pitt Robotics Club study tips 0 303 03-05-2013, 02:40 PM
Last Post: study tips
  Porting mobile web application engine to the Android platform pdf study tips 0 395 04-03-2013, 04:00 PM
Last Post: study tips
  PIC Microcontrollers pdf study tips 0 398 11-02-2013, 02:33 PM
Last Post: study tips
  PIC 8 BIT AND 16 BIT MICROCONTROLLER ARCHITECTURE seminar tips 0 353 07-02-2013, 04:24 PM
Last Post: seminar tips
  PIC Communication with USB pdf project girl 0 270 25-01-2013, 12:44 PM
Last Post: project girl
  8-bit PIC® Microcontrollers pdf project girl 0 368 19-12-2012, 05:45 PM
Last Post: project girl
  STUDY OF PIC MICROCONTROLLER REPORT project girl 0 582 14-12-2012, 06:48 PM
Last Post: project girl
  HI-TECH C Compiler for PIC MCUs seminar tips 0 324 04-12-2012, 05:30 PM
Last Post: seminar tips
  PIC Microcontroller FULL REPORT seminar tips 0 569 10-11-2012, 06:01 PM
Last Post: seminar tips