When the question was asked about converting 16F84 code to 12C509, I noticed two points that weren't being made. The first is, how the subroutine "call" instruction works. Subroutines have to be in the first 256 instructions of the 12C509's (and other "low-end" architected PICs) code page (which is 512 instructions). This is not a restriction in the 16F84 (and other "mid-range" parts). You can get around this by putting the labels at the start of the code page and then executing a "goto" to the actual subroutines. By doing this, the subroutines can be anywhere in the code page. The second problem is the code page itself. In the mid-range architected parts, the code page size is 2K, in the low-end architected parts (which the 12C509 belongs to), the code page size is 512 instructions. If you have a program that jumps (either "goto" or "call") to a label from one code page to the other, you're going to have to set/reset the "PA0" bit in the STATUS register. And just as final a note: "return" is a valid assembler instruction in MPASM for the 12C509 even though the instruction doesn't exist in the 12C509. You'll find that "return" is substituted with "retlw 0" (I found this out the hard way). If you want to develop and debug your code on the 16F84 it is possible by using macros with conditional code which will avoid these problems. Developing these macros with conditional code (basically looking for a device type for _12C509 or _16F84) isn't that difficult, but it won't be trivial. It would also be a pretty good learning experience for you, if you're new to the PICMicro. It will probably be easier for you to just buy a few windowed 12C509s and work through the application using them directly. myke >Whether the code changes, it depends. In principle, yes, bcus the 12C509 >has the (obsolete) 12-bit kernel, i. e. >- no IT >- only 2 level of subroutine calls allowed (instead of 8) >- simpler instruction set (slightly) >- of course: no internal EEPROM >- less RAM I guess > >And a personal experience: no PICs dead in my hands except a windowed >12C509, and w/o any obvious reason. Since I have some fear against it. If >you must save REALLY try 16C54B (has the same disadvantages but maybe less >sensitive). > >Imre > > >On Thu, 21 May 1998, PHXSYS wrote: > >> Hi >> >> I have some simple code I wrote and debugged for a 16F84. It only uses 4 pins. >> I was wondering what changes I would have to make to use a 12C509? >> >> This chip is much cheaper and I don't need the 16F84's 13 i/o lines or the >> flash. I see the eprom specs for the 12C509 is 1Kx12 vs 1Kx14 for the 16F84. >> Does that change the way code is written? >> >> Jon >> >> > > "In this life we all get an equal share of ice. The rich get it in the summer, the poor get it in the winter." - Bat Masterson's last words