Of course you can implement a state machine any way you like in TOS.
There was a recent set of posts by someone who has (partially?)
integrated SM generation for TOS via UML, if you really want
to get whacky with it...

"atomic" is useful when you have multi-byte variables or structures
that can be accessed from both the interrupt and task levels.
Mostly one wants to be sure one is not interrupted when changing
the first of two bytes in a short (or longer) int, and you may
find it useful for implementing simple semaphores and such.
Generally the TOS nescc pre-compiler will whine if you have
variables that might violate atomic principles, so you can go
look and see if there's a problem.

I don't know of a SM tutorial, especially using TOS. I'd guess
that any sufficiently interesting CompSci textbook would cover it.

MS

[email protected] wrote:
> Hello again,
> 
> I have some questions concerning Statemachines in TinyOS:
> 
> I built a method for headercompression in TinyOS, which seems to work  
> OK. Since it's a two stage method that uses timeouts etc. I built a  
> FSM to do all the "control-stuff".
> 
> Now that I've begun trying it with CTP I get into trouble... For  
> example removing a printf can screw the whole thing up. My guess is,  
> that that's due to errors in the statemachine or to an "unsafe"  
> implementation.
> 
> Therefore I have the following questions:
> -Can I implement a statemachine using just some state-variable and  
> switch-statements? Or do i need to use some module provided by TinyOS?
> 
> -Do I need to read/write to that variable with atomics? What happens  
> if I don't? I always thougt TinyOS would return to the position in the  
> code where it was at when it received an interrupt.
> 
> -Does anyone have a link to a tutorial on building statemachines? I  
> need to fix this asap (better yet: yesterday).
> 
> Thank you in advance for your suggestions,
> 
> Tobias
> 
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to