In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote: I just got them ready. The schematic explanation of the taskswitching is in the pdf. The vp_test.txt is the same as vp_test.c but for online viewing. sxchips.zip contains the sx header files with my additions (eg. membank defines and chiptype and chipsize defines) libraries.zip contains all my libraries, including taskswitching and dynamic vp loading. The test program is a working demo how tasks and vp code work together. TASK routines control queues for vp code, whereas mainlevel code controls the same queues but in the opposite direction. (eg. if mainlevel code fills a queue, then a TASK subroutine empties it). The VP definitions have been simplified and extended. The vpUart objects have now predefined queues in their unoccupied space (a vpUart requires 10 bytes and the remaining 6 bytes are a queue). You do not need to use the queues but the demo does use them. Biggest problem was the fact that cc1b distinguishes two call trees: interrupt and mainlevel. Because local variables are statically allocated at fixed addresses during compilation, a subroutine with local variables cannot be called from both interrupt and mainlevel. The taskswitching adds another call tree because taskcode can be interrupted by the interrupt. As far as cc1b is concerned, taskcode is part of the interrupt call tree. For this reason I had to rewrite the Portpin.h and objQueue.h libraries to support any call tree. The Portpin.h library now consists mainly of macros but that does allow port and pin manipulations from both mainlevel and tasklevel code using the same functions. (The alternative was to copy and rename functions but that would increase codesize and is not very attractive). The test program is a simple bidirectional uart, communicating at 9600 baud, 7 databits, 2 stopbits, even parity. Note that the receive uart has inverted mode specified. This is because of the simple RS232 interface. Next step is to really use dynamic vp loading by stopping and starting vp's but for that I need first to setup a board with a max232 for 4 rs232 lines. 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=212299#m213863 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)