You're welcome. IMO the state machine is *the* most important concept for real time embedded systems development.
Joep 2012/9/23 dirk <[email protected]>: > Thanks Joep for your advise. I have now stopped investigating the use of > tasks for my project. > In the last days I reprogrammed my subroutines to delay state machines and > three procedures are working nicely together now. I never programmed state > machine procedures before, so this was a fine practice for me as well. > Thanks again for pointing me in this direction. > > Greetz, Dirk > > Op donderdag 20 september 2012 08:43:47 UTC+2 schreef Joep het volgende: >> >> Hi Dirk, >> >> Most of my apps have what you could consider 'tasks'. However, I use >> non-blocking state machines instead of the jal TASK feature, because I >> fail to see the added value of this feature since it only allows >> 'suspend' at level0 (there are other reasons too, similar to the >> discussion if/when an RTOS is worth while). >> But I am happy to learn, so please enlighten me if you think I am >> missing something ;) >> >> When reading the issue, the first questions that comes to mind are >> - does blinking work as expected without tasks? >> - is the issue in the isr (in other words: does it take more time to >> decrease the counter) or in the task/main loop (does it take more time >> to see the counter is zero)? >> - is the issue also there when you don't start the second task? >> I had a glance at your code and it looks okay and clean to me. You >> might want to take a look at the asm file to see what code is produced >> by the compiler to handle both tasks (and particual, the way it >> suspends / switches). >> I don't recall much on tasks at the yahoo jal group, but since this >> group is much larger, you might get more info there. >> >> And in case you can't convince me to give tasks a try, you might >> consider creating your 'tasks' as small, non-blocking procedures and >> call them from the main loop. The delay slot sample shows how to >> control the calling frequency of different tasks. >> >> Joep >> >> >> 2012/9/20 dirk <[email protected]>: >> > Hello group, >> > >> > I am trying to do a project with several tasks, but I am having trouble >> > getting it going. >> > Can anyone tell me why the following code doesn't work? >> > >> > -- JAL 2.0.4 >> > include 18f2520 >> > pragma target clock 20_000_000 -- oscillator frequency >> > -- Configuration memory settings (fuses) >> > pragma target OSC HS -- HS crystal or resonator >> > pragma target WDT disabled -- no watchdog >> > pragma target LVP disabled -- no Low Voltage Programming >> > -- >> > pragma task 2 >> > -- Enable delays without blocking >> > const timer0_isr_rate = 1000 -- 1 kHz isr rate >> > const DELAY_SLOTS = 1 -- support 1 delays at the same >> > time >> > include timer0_isr_interval >> > timer0_isr_init() -- init timer0 isr >> > -- >> > enable_digital_io() -- Make all pins digital I/O >> > -- >> > PORTA_direction = OUTPUT >> > -- >> > task Something() is >> > forever loop >> > --do something >> > suspend >> > end loop >> > end task >> > -- >> > start Something() >> > set_delay(0, 100) >> > forever loop >> > if (check_delay(0)) then >> > pin_a0 = ! pin_a0 >> > set_delay(0, 100) >> > end if >> > suspend >> > end loop >> > >> > I expected the led on pin A0 to blink every 10th of a second, in stead >> > it >> > blinks at a much slower rate (every minute). >> > >> > Please help me out. >> > Greetz, Dirk >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "jallib" group. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msg/jallib/-/d5RX2TFoiAgJ. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > For more options, visit this group at >> > http://groups.google.com/group/jallib?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/jallib/-/5CRI11nsvfYJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/jallib?hl=en. -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
