Today 12:07
Forum: The Lounge
Starter: yvesmazzon
Views: 0
Replies: 12
Today 10:21
Forum: Proton 24
Starter: charliecoultas
Views: 0
Replies: 9
Go to last post By: J. Mark Wolf
Today 01:01
Forum: Proton Plus Compiler v3
Starter: SELCUK
Views: 0
Replies: 1
Yesterday 21:34
Forum: Proton Plus Compiler v3
Starter: H-bert
Views: 2350
Replies: 51
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,103
    Thumbs Up
    Received: 57
    Given: 0
    Total Downloaded
    1.09 GB

    1 Not allowed!

    Default New P-RTOS24 multitasking real time OS for Proton24

    I have just released PRTOS24 onto the Wiki together with a demo program, help file, ISIS circuit diagram and simulation project file for use with the demo program. This is a co-operative Real time operating system which will provide users with a multitasking platform on which to develop their applications. Currently it supports USART I/O but I plan to add SD Card and Graphics LCD drivers to the system in the future.

    I would welcome feedback on the project and hope some of you might find this useful.

    You can find the article here
    JohnB

  2. #2
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    192
    Thumbs Up
    Received: 6
    Given: 2
    Total Downloaded
    83.40 MB

    0 Not allowed!

    Default Re: New P-RTOS24 multitasking real time OS for Proton24

    JohnB,
    Hi ,
    Interesting project which may solve a niggle I have had for a few years now. I have built a number of flight instruments which perform several tasks providing in flight information, updating an LCD and produce changing audio signals to indicate the rate of climb . In essence the core proccess are:-

    1) Get barrometric data from MS5611 sensor
    2) Proccess barometric data into altitude data
    3) Update LCD to display altitude
    4) Get barrometric data from MS5611 sensor
    5) Proccess barrometric data into rate of change data
    6) Generate an audable tone propotionate to rate of barometric change
    7) Output audable tone to transducer
    8) Update LCD to display rate of climb/sink
    9) Get GPS strings from GPS
    10) Choose specific sets of GPS data from multiple strings
    11) Concaternate all the bits of GPS data into one flight data string
    12) calculate check sum and add to string
    13) save string to SD Card
    14) Update LCD with GPS data, ie speed,heading, distance traveled, heading to next waypoint etc.

    Gosh it seems a lot of work and I am gob smacked I managed to do it. That said I have never been happy with one PIC because of timing issues, whilst it does work there are pauses here and there, almost as though the PIC is catching up. for example the wait command in the GPS routine to receive the GPPGA sentence may occur just as I fly into a thermal and the rate of climb tone therefore lags too far behind (at least thats I thought). The tone generation sometimes misses a beat. I have put these niggles down to having to do lots of complex things, and once a process has started the next process has to wait, even if its not that important. If I could set priorities and assign them to a process this may be the answer. In my project the vario, or rate of climb indication is KING nothing should cause it to pause if climbing, of if something else is being processed when I start to climb it should pause and pass control to the vario. I have resorted to using two pics one for vario and one for rest to resolve the issue. It would be great to do it on one PIC chip.

    I would welcome your thoughts if PRTOS24 may come to the rescue or is it just poor programmiing on my part
    regards
    jez
    Last edited by Jezsmith; 24th September 2017 at 18:36.

  3. #3
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,103
    Thumbs Up
    Received: 57
    Given: 0
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: New P-RTOS24 multitasking real time OS for Proton24

    From what you tell me so far I certainly think it is a suitable project for PRTOS24. I can't comment on your current program, perhaps you just need a faster device.
    It would be an interesting application to map on to PRTOS24 and would be very informative. What sort of sampling rate are you working at? On my demo program I have an OS tick of 100Hz. You can do quite a bit of work on a PIC24 in 10 mSecs. Obviously you don't have to sample all parameters at that rate, your GPS data could be sampled at a much slower rate. What PRTOS24 can give you is the ability to do something else while waiting for an event so the GPS waiting doesn't have to be at the expense of sampling the barometric pressure.

    I would be happy to assist where I can if you want to give it a go and if we find PRTOS24 lacking I am more than willing to work on improvements where practical.
    JohnB

  4. #4
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    192
    Thumbs Up
    Received: 6
    Given: 2
    Total Downloaded
    83.40 MB

    0 Not allowed!

    Default Re: New P-RTOS24 multitasking real time OS for Proton24

    Johnb,
    The sampling rate for the barametric sensor is 3ms but need multiple readings to average out the noise and get a smooth change, the GPS can be once per second not critical. I make the tones of 1 to 2.5 khz by toggling a pin in an ISR, the rate of toggle is linked to the rate of altitude change from the sensor. I use a second ISR to toggle a transistor on and off to make an interupted occillator 1Hz to 6Hz so the tone and beep rate goes up as the climb rate goes up. Lots to think about.
    cheers
    jez

  5. #5
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,103
    Thumbs Up
    Received: 57
    Given: 0
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: New P-RTOS24 multitasking real time OS for Proton24

    I think running RTOS with a 3mS tick would create quite an overhead unless you were to run a 24EP device at its maximum clock rate. I haven't calculated how many clock cycles are required for a context switch, it would be a useful figure to know. A context switch will use a fixed number of cycles give or take a bit so the faster the PIC lower the overhead at a given tick rate. I'll try and get you some numbers and that will tell us whether it is will be a goer.

    You could do the barometric sampling outside the OS using a Timer and create an event to the OS when you have a filtered reading.
    JohnB

  6. #6
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    192
    Thumbs Up
    Received: 6
    Given: 2
    Total Downloaded
    83.40 MB

    0 Not allowed!

    Default Re: New P-RTOS24 multitasking real time OS for Proton24

    Johnb,
    OK thanks may have a go and see how it goes. I will look at a the MPL3115 which does a lot of the work on chip and outputs a result every 250 - 500ms not sure how steady it will be.

    regards
    jez

  7. #7
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,103
    Thumbs Up
    Received: 57
    Given: 0
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: New P-RTOS24 multitasking real time OS for Proton24

    I have updated the P-RTOS24 Demo program to show the active task and event lists, corrected the Error Handling test and removed redundant Error checks originally included before full error handling was introduced.
    JohnB

  8. #8
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,103
    Thumbs Up
    Received: 57
    Given: 0
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: New P-RTOS24 multitasking real time OS for Proton24

    Jez

    I have done some timing tests on RTOS with the processor running at 64Mhz....

    Context Switching
    With 1 task running and 1 task waiting on event, the context switch takes 40uSecs. I.e The time from an OS_Yield to the OS returning to that task is 40uSec. This includes saving the Context of current task, determining which task is next to run, restoring the Context of next task and resuming the task.

    Tick Processing
    Each tick is taking about 10uSec to process which means that every tick the context switch is extended to 50uSecs. Each tick evaluates tasks which are waiting on timeout and makes timed out tasks eligible at next context switch.

    Hope this is useful.
    JohnB

  9. #9
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    192
    Thumbs Up
    Received: 6
    Given: 2
    Total Downloaded
    83.40 MB

    0 Not allowed!

    Default Re: New P-RTOS24 multitasking real time OS for Proton24

    johnb
    thanks not 100% sure what that means practicaly but its looks quick. I am working on the gps readings and printing to LCD in the system first, as a first step
    regrads
    jez
    .

  10. #10
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,103
    Thumbs Up
    Received: 57
    Given: 0
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: New P-RTOS24 multitasking real time OS for Proton24

    I was surprised just how quick it was.

    To test the Tick processing I toggled PortB.8 at the start and end of the Tick ISR and measured the time between high and low.

    To test the Context switch, I modified a task in the demo program as follows:

    Code:
    Task10:
    Do
      High PortB.10
      OS_Yield
      Low PortB.10
      OS_Yield
    Loop
    At startup the only task running is the menu task.
    That runs to display the menu then goes into a wait state waiting for user input which means the MPU is idling in the OS.
    When a character is input an interrupt is raised and an event queued. At the next OS tick the event will be processed and the menu task resumed.
    The Menu will start the above task and return to a wait state.

    I measured the time between each change of state of PortB.10 to establish the context switching time.

    These P24 MPU's are pretty quick.
    JohnB

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replies: 0
    Last Post: 13th August 2017, 17:44
  2. P-RTOS24 Real Time OS and Demo Program
    By johngb in forum Proton 24
    Replies: 0
    Last Post: 3rd April 2017, 10:12
  3. MPLAB REAL ICE for PROTON24
    By xldaedalus in forum Proton 24
    Replies: 1
    Last Post: 4th January 2014, 06:44
  4. Real Time Clock
    By belsenthegreat in forum The Lounge
    Replies: 5
    Last Post: 27th February 2007, 22:14

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts