Searching \ for '[PIC] software flow' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'software flow'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] software flow'
2008\04\22@131839 by Martin

face
flavicon
face
Are there any good books or resources that you would recommend about
designing software on the PIC? I don't mean "this is how you make an LED
blink" or "this is how you drive a stepper motor" but more like a
system-level design where you might have a timer-interrupt drive a state
machine that would accomplish 10 different tasks that you have to do?
(just an example, I don't know if that's how you'd actually do it)

Also I've had a quick look at the likes of FreeRTOS - but I'm using
assembly. I feel like the only benefit of using C would be that my code
is more organized and perhaps quicker to develop (but then there'd be
low level bugs I can't see easily)

Does anyone use an RTOS with assembly in their PIC 18F project? Would it
be very difficult to write some time-sharing code for a PIC?

-
Martin

2008\04\22@151025 by sergio masci

flavicon
face


On Tue, 22 Apr 2008, Martin wrote:

{Quote hidden}

If you build your system as a pure state machine (lots or states and
events and NO hanging around in a state waiting for something to happen)
then multitasking can become VERY simplified. You could even run multiple
state machines on the same CPU and have each one looking after a different
task (they could send each other events or communicate in other simple
ways).

C is not very good for multi-tasking because C does not know about
multi-tasking, instead you need to use a library which introduces
overheads and the seperate tasks can interfere with each other and there
is no way for the compiler to know or generate task safe code.

Converting a straight forward C or ASM program into a state machine can
easily become tedious and error prone since the better you break down the
program into a state machine the more states and events you produce. The
more states and events you have the harder it is to keep track of
everything (maintain and debug it).

So what you need a tool that is to state machines as a C compiler is to
machine code. You need a tool that takes a high level description of a
state machine (which is easy to maintain and debug) and from it generates
executable machine code. From choise you would use a tool that uses state
diagrams to describe the state machine and allows you to debug your code
using the same state diagrams - kind of like source level debugging in C
or BASIC but on the diagram. I have a tool like this and it is called
ZMech. There are other tools around. Some require that you specify the
state machine in a high level text based language. Others that allow you
to use diagrams. Some will only generate complex C++. Others that will
generate C. But I haven't come across any (other than ZMech) that will
allow you to produce machine executable code and interactively debug it
directly against the state diagrams.

Going back to the alternate multi-tasking approach, there is the XCSB
compiler which produces highly efficient machine code executables. The
language has multi-tasking built into it and the compiler generates task
safe function calls without resorting to the runtime overhead of a dynamic
stack and multi-tasking library.

The LITE edition of XCSB if free for hobbyist / student use
(non-commercial) and you can get it from:

http://www.xcprod.com/titan/XCSB

The following might give you some ideas that you can either implement
yourself (maybe with paper and pencil) or things to look out for in an
automated dev tool:

http://www.xcprod.com/titan/ZMECH-DOC/generate/state-machine/block-indx.html

Regards
Sergio Masci

2008\04\22@200708 by Bob Axtell

face picon face
I use a formal flowcharting tool, like Visio, but there are inexpensive
ones that I like better.
Flowcharting allows several people to work on a large project separately.

--Bob Axtell

sergio masci wrote:
{Quote hidden}

2008\04\23@001240 by William \Chops\ Westfield

face picon face

On Apr 22, 2008, at 10:17 AM, Martin wrote:
> more like a system-level design where you might have a timer-
> interrupt drive a state machine that would accomplish 10 different  
> tasks that you have to do?

John Peatman's "Embedded Design  with the PIC18452 Microcontroller"  
is rather like that.  He starts by introducing a timer tick that  
"goes off" every 10ms, and adds different peripheral support  
functions as you go through the book.  (The tick starts out NOT
being interrupt driven...)  The book is pretty expensive, and I  
didn't like it very much (I considered it to spend too little time on  
understanding the instruction set), but I think I'm willing to  
concede that it's a valid perspective on systems level usage.  There  
are a couple of chapters online at http://www.picbook.com

BillW

2008\04\24@153718 by sergio masci

flavicon
face

Hi Martin,

The following is a work in progress but may be of help:

http://www.xcprod.com/titan/state_machine.pdf


Regards
Sergio


On Tue, 22 Apr 2008, Martin wrote:

{Quote hidden}

2008\04\24@190004 by Dario Greggio

face picon face
sergio masci wrote:

> The following is a work in progress but may be of help:
>
> http://www.xcprod.com/titan/state_machine.pdf

nice and clear, thank you Sergio.

--
Ciao, Dario -- ADPM Synthesis sas -- http://www.adpm.tk

2008\04\24@200951 by sergio masci

flavicon
face


On Fri, 25 Apr 2008, Dario Greggio wrote:

> sergio masci wrote:
>
> > The following is a work in progress but may be of help:
> >
> > http://www.xcprod.com/titan/state_machine.pdf
>
> nice and clear, thank you Sergio.

You're welcome.

As I said, it's a work in progress. So check back in a few days and there
should be more for you to get your teeth into.

Regards
Sergio

2008\04\27@162353 by sergio masci

flavicon
face


On Fri, 25 Apr 2008, Dario Greggio wrote:

> sergio masci wrote:
>
> > The following is a work in progress but may be of help:
> >
>
> nice and clear, thank you Sergio.

I've updated the document and given it a web page of its own so that you
can now check for updates without having to download the entire document
every time.

I've added info to help the inexperienced understand how to draw a state
diagram avoiding critical event order and how to debug a state diagram and
add missing states.

It is still a work in progress and there is still much to cover.

You can download the latest version of this ebook from:

http://www.xcprod.com/titan/state_machine_ebook.html

If you find this ebook useful then please place a link to its web page on
your web site.

Thanks.

Regards
Sergio

2008\04\27@164654 by Dario Greggio

face picon face
sergio masci wrote:

> You can download the latest version of this ebook from:
> http://www.xcprod.com/titan/state_machine_ebook.html

Thanks again Sergio!

> If you find this ebook useful then please place a link to its web page on
> your web site.

ok, I'll try to find a place for that.

--
Ciao, Dario

2008\04\27@223828 by Rikard Bosnjakovic

picon face
On 28/04/2008, sergio masci <spam_OUTsmplxTakeThisOuTspamallotrope.net> wrote:

>  You can download the latest version of this ebook from:
>
>  http://www.xcprod.com/titan/state_machine_ebook.html

Sergio,

This work of yours is a remarkable piece of document. Knowing nothing
about state machines, I read it page by page and can't wait for the
next version to see who the murderer is.

Or seriously, while I'm not having the need for a state machine at
this time the document introduced me a few interesting ways of
debugging, something which I welcome a lot. For the skilled, the
document is probably on a too low level but for a "zero knower" it's
perfectly levelled without being too basic.

Keep up the good work!


--
- Rikard - http://bos.hack.org/cv/

2008\04\28@020244 by sergio masci

flavicon
face


On Mon, 28 Apr 2008, Rikard Bosnjakovic wrote:

{Quote hidden}

Thank you.

More... (looser matching)
- Last day of these posts
- In 2008 , 2009 only
- Today
- New search...