In SX Microcontrollers, SX/B Compiler and SX-Key Tool, sammishal wrote: Hi All, Thanks PeterV. I was looking at this stuff and it looks like the thing I need. I think your library is great too. I am actually currently working on something exactly the same to emmulate all the commands in SX/B e.g. SerIn/Out, ShiftIn/Out, PulsIn/Out etc. I think all these commands is what made the Stamp very handy. I like the speed price and felxiblity of the SX and like to program in SASM but all these handy commands in the Stamp make development of a system and trying out projects very easy and painless. I think if we had a library of routines that we can quickly use then the SX development would be as easy. The SX/B compiler helps a lot. By the way the version I am using is the one that is envoked auto by the SX_Key IDE. Is there a way I can make it envoke the latest version??????????? The problem with Macros is that they are expanded as code inplace of the macro call. So if a command is made into a macro and then used multiple times there will be redundant code all over the place and since the SX's memory is not,lets say, extensive then the macro solution should be looked at carefully. I think this is what the SX/B does. Commands like ShiftIn are expanded into code wherever they are encountered. Here is my suggestion: Subroutines should be created and Macros should be defined as wrap-arounds. That is a subroutine should be developed and that way only the calls to it only would be repeated in the code. The Macro wrap around is the way into the routines. The macro is passed all the required parameters. The macro then does any setup required (flags,variables, etc.) and then the macro calls the subroutine. Of course if the user does not require the subroutines he should not include them in his code. The limitation on include files is if they are nested only, not if they are linear. So here is a structure I propose: -An Include file for All the EQUs and Definitions -A seperate include file for all the Variable definitions for each Routine. It has to have the correct ORGs. Attention to Banking, but macros should help with this. IE all variables to be used by the user are Set or Got by a macro to get/put them. This way each Variables .inc file is included only if it's subroutines .inc files is included. (maybe with the correct ORG statements we can have the routines .inc file do both) -One include file for all the macros for all the library to be included at the top. Since macros are definitions and are only expanded as code where they are called, there would be no additional code unless it is needed. Thus this is can be only one big file, not seperate files for each routine. -A sperate include file for each subroutine to be included under an ORG statement to position the subroutine were it is desired to have it in the code.....attention to Paging and Top of Page etc. (Macros would help with this) -An include file for each section of the ISR to be included within the master ISR as desired and if the routine requires it. conditional directives might be needed to modify the RETIW value (again macros would help here) This way the Macro Call would look Something like this ShiftIN Pin,Mode,Value,Size Of course the user of the library has to know a lot more about how to use the library than just using a command like in Basic. A tall order I guess. But I am working on this right now, in my spare time. I hope PeterV's stuff will help. I will post my stuff when it is ready. Samuel ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=103788#m103918 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)