It is currently Mon May 21, 2018 7:12 am



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Size added by RTOS
PostPosted: Mon Jun 03, 2013 11:21 pm 
Offline
User avatar

Joined: Thu May 30, 2013 1:11 am
Posts: 54
Quick question: know we are getting close to the upper limit of the free software. Has anyone taken a look at how much extra size is added by COCOOS? Or was the extra size of the RTOS offset by being able to remove the state machine code?

Clint


Top
 Profile  
 
 Post subject: Re: Size added by RTOS
PostPosted: Tue Jun 04, 2013 8:03 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
That's a good question. We went round and round with this and I think Paul S, as the lone dissenting voice still runs a version without it.

The primary driver to go to an OS was really about easier to manage code than anything else. As we began to build up the actual engine control portion it became apparent pretty quickly that just about everything really wanted it's own time base and trying to avoid that by just running everything every pass through the code wasn't really possible with the amount of features we envisioned.......the OS solves all that without filling the control code itself with counting and by-pass schemes.

We had a long talk about state machine operation then and again recently.....and it becomes a really tangled nearly impossible to fully test mess of sub-states pretty quickly and not well suited to a DIY project.

What we kind of settled on and what I'm trying to enforce is a modular or maybe layered is a better term structure. The idea being well defined pieces (tasks) can be created, dropped in, and tested a whole lot easier and with a whole lot less risk and also makes the code a whole lot easier to understand and edit.

So the OS is about code and project management more than anything else I guess.


Top
 Profile  
 
 Post subject: Re: Size added by RTOS
PostPosted: Tue Jun 04, 2013 4:31 pm 
Offline
User avatar

Joined: Thu May 30, 2013 1:11 am
Posts: 54
The aquarium controller I built, well, for my aquarium had the same issue: It needed about 7 different time bases. This system used a square wave interrupt from a DS1307 RTC to generate the base "beat" at 4096 Hz. I then had a very simple interrupt function called at each beat and it set several flags if conditions were met:
    1 ms
    250 ms (aka: 4 times per second)
    1 second
    1 minute
    1 hour
    1 day

The once per minute flag was actually broken up into three different flags that occurred at specific seconds of the minute so I could tell the temperature sensors to start a temperature conversion at once specific time, then give them the time they needed before I read the new temperatures.

The main loop was broken up into if (1 ms) then..., if (1 second) then... type calls and the appropriate items were called when there flag was set by the interrupt. I also had a function (checking for external pin change from keypad) that was called every single pass through the main loop with no if loop call.

It worked very well. The stuff I needed to run VERY fast ran very fast, the stuff that needed to run slower ran slower and the things that had to run in specific time slots relative to other events ran in there time slots. Part of the reason it worked as well as it did is that I was reading the RTC once per second to update the time so I could use the seconds:minutes:hours:days values to calculate flags.


Top
 Profile  
 
 Post subject: Re: Size added by RTOS
PostPosted: Tue Jun 04, 2013 5:27 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
It can definitely be done without an OS and as I said there was much debate....but the OS keeps the actual control code the simplest and that won the day way back when the question was on the table.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Theme designed by stylerbb.net © 2008
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All times are UTC - 5 hours [ DST ]