In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote: The VP libraries are updated. I added pinSetup for the vpInstall() function so all elements for dynamic VP loading are in place. Had to redefine the PORTPIN values to make the code more compact. To prevent possible glitches on I/O pins when port direction registers are updated from both mainlevel code and interrupt code, I declared DDR copy registers in bank 0xF0. This also has the benefit that SX28 code can read the direction registers (actually the copies), but more importantly, it offers an easy way to prevent glitches. The sequence to write to the DDR registers, once M is set, is: MOV W,DDRACOPY ;any DDR copy register MOV !RA,W If an interrupt occurs inbetween those 2 instructions, and the interrupt would update direction bits for port RA, then the interrupt update becomes undone. The function DDRupdate in library Portpin.h inserts an extra clockcycle when an RTCC rollover would occur inbetween those 2 instructions. As a result, the interrupt occurs before the MOV W,DDRACOPY instruction, so if the interrupt update the DDR registers, the change is maintained. Library Portpin.h contains a large number of small routines to make pins inputs or outputs, low or high and also a large number of small routines that operate on ports. The VP uarts have been updated and now include code for handshaking. With the port and pin functions available I can start to make a real demo program that actually runs. The attached vp_test.c compiles without error so you can checkout the generated code. In a couple of days I should have a working demo that demonstrates the loading and unloading of virtual peripherals. Unzip libraries.zip to the CC1B folder. Place vp_test.c into the C4SX folder. 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=208986#m209783 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)