Andries Tip wrote: > http://www.piclist.com/Techref/member/AT-planet-T9/datalogger.htm To the OP: This may be good to look at to get the logic. He seems to have done a reasonable job of documenting that. However, do NOT try to emulate this structure. This code lumps everything into a single file, hard codes variables to specific addresses, hard codes assumptions about variable banks in the code, manually allocates routines t= o pages then hard codes assumptions about what pages routines are on, and on top of that it's all absolute code. These are all bad practises. Imagine the mess if you ran out of room in a bank and needed to move some variables around. There are better ways of doing this, even with native MPASM tools. The BANK0 - BANK3 macros in this code are particularly silly since they have no advantage over the built in BANKSEL. Both always set both bank bits, so there is no efficiency gained by using his BANKn. However, BANKn requires you to know what bank a variable is in, something that the tools have no wa= y to known you are doing and therefore no way of checking. BANKSEL at least sets the bank according to the known address of the thing you are trying to access. If you move a variable around, BANKSEL will follow whereas BANKn becomes a subtle bug with symptoms usually appearing in unrelated areas. The PAGEn macros are similarly silly, with PAGESEL being the built-in equivalent of BANKSEL for pages. There are more examples of bad programming in this code, but hopefully this is enough to scare you away from anything but the logic embodied in it. Given the general level of programming structure though, I would look at th= e logic very carefully before just using it. Stone age thinking in one place is often a indication of stone age thinking elsewhere too. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .