In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote: Attached are updated libraries. The library Task.h allows to run up to 5 tasks in the background on a regular interval. These tasks exexute outside the interrupt routine with interrupts enabled. When a task subroutine is executed, the mainline code is not executed, but interrupt code continues. You can compare it to the BASIC feature ON TIMER GOSUB. The task subroutine must return to allow the mainline code to continue. The test program declares 5 tasks (simply updating a memory location) that run continuesly while the mainloop code does nothing (while(1) ;) You can run it directly with sxsim. Uncheck 'run isr' and uncheck 'check reti' If you set a breakpoint at the end (the while(1) loop) and then hit run the initialization is done fast. Then remove the breakpoint and hit walk. Observe the memory locations 0x50-0x54 and 0x70, as these are updated by the tasks. cc1b throws a warning about Task.h line 436. You can ignore that. Since the test file is for sx28, make sure to comment out any CLRB 4.FSR_7 in the generated .src file (this bug is fixed in the next cc1b release). The attached .src has the CLRB 4.FSR_7 already commented out. To make it work I had to use #pragma unlockISR so I could place the interrupt routine anywhere. At origin 0, I inserted /*<?asm JMP @iServer JMP @TaskSchedule ?>*/ so there is a fixed address (0x002) for calling TaskSchedule. cc1b does not allow us to use function names as constants (which it could because function names are labels). The workaround is not too bad. regards peter ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=211049 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)