In SX Microcontrollers, SX/B Compiler and SX-Key Tool, g_daubach wrote: Hi Peter, yes, I absolutely agree. You can look at a VP from "inside" and "outside". Let's assume a serial transmitter. With (as you said, and this is of high importance) a "well-defined" software interface, the application code "inside" the controller must not care if this serial transmitter is realized in hardware, or in software. Most likely, there is a transmit data register, where the application stores the byte to be sent, and there is some kind of a "busy" flag. As long as this flag is set, the transmitter is busy, and no new data may be written to the transmit register. When it is clear, the application can write another byte to the transmit data register, and then set the busy flag to indicate the transmitter that it has another byte to send. In this example, the interface simply consists of one register, and a flag. From the "outside", you only "see" a serial out pin going low and high according to the specified serial transfer protocol, and it does absolutely not matter if this is caused by some special hardware inside the controller, or by software, clearing and setting this output pin accordingly. Besides a well-defined software interface, another important aspect when designing VPs is that their operation must be transparent to the rest of the program code. It it obvious that the VP code must not change any register contents, status flags, etc. causing unpredictable results in other parts of the code. What developers sometimes overlook is the fact that execution of VP code "steals" execution time from the main code, so you can't - for example - use a delay loop in the main code, expecting that this provides a constant delay time when this loop is periodically interrupted to handle the VPs in the ISR. Well, there is no need telling YOU all that - you are the expert here but maybe, our little discussion is good to provide some ideas for other readers. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=103848#m104102 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)