ok, if it's that easy I might be talked into doing it. Would I do 16f628 or 16f628A? Not sure what the difference is between those with/without the A.. just an update of some sort? I see that the EasyProg supports the 16f628.. so maybe I'm back to getting that.. Decisions.. decisions.. Maarten Hofman wrote: >>I think I might go the route of getting a 16f84 first, then moving to a >>16f628. Especially since a book a bought a while back only uses the 84.. :) >> >> > >If those are your choices, do yourself a favor and start with the >16F628 instead of the 16F84. Conversion of any code you might >encounter in the book is relatively simple: > >1. Change variables >The range of variables on the 16F628 start at 0x20 instead of 0x0C. >This means you will either have to: >a) do nothing, in case the book uses proper relocatable code. >b) change CBLOCK 0x0C into CBLOCK 0x20 >c) change any register definition (EQU) pointing to a register between >0x0C and 0x1F to one that is higher or equal to 0x20. > >2. Initialize CMCON register to change all pins to 16F84(A) configuration >This is done with the following code: > movlw 0x07 > movwf CMCON >If you want you can put this between a check whether CMCON exists, in >which case the code will remain compatible with the 16F84. > >3. With 1-2 you will fix most of the simple code. However, some code >for the 16F84 blithely assumes that registers are accessible >regardless of the settings of RP0 (and RP1). You can either fix this, >or, if you use less than 17 registers, make sure (in step 1) that all >registers point to 0x70 to 0x7F. Also, if the code uses an interrupt >routine and the interrupt routine ignores proper RP0 (and RP1) >setting, you will either need to add that to the interrupt routine, or >move all interrupt variables to the 0x70 to 0x7F region. See the >16F628(A) manual for a good way to save and restore variables from >interrupts properly. > >4. If the code uses EEPROM, note that EEADR and EEDATA are no longer >in bank 0. This means that before accessing EEADR or EEDATA you will >need to do: > banksel EEADR >and afterwards, when using a register in bank 0 again, you need to > banksel >again. See the 16F628(A) manual for a good way to access EEPROM memory. > >5. If the code uses the EEIE bit in INTCON, use EEIE from PIE1 >instead, and make sure to surround it with the appropriate banksel >statements (see 4). The same counts for EEIF in INTCON, which moved to >PIR1. > >6. Add _LVP_OFF to the CONFIG statement to free up RB4. If you want to >keep your electronics simpler too, you can also disable the reset pin >(in which case it doesn't need to be pulled up anymore) and use an >internal oscillator (in which case you don't need a crystal anymore). >Add the appropriate CONFIG bits for this, if you want, but make sure >your programmer/software will still work under that configuration. > >This seems like a long list, but I also had a book that only use the >16F84A, and I discovered that very little needed to be changed, most >of the time. If you write your own programs, and they are not going to >use the limits of the particular PICmicro, it is recommended to NOT >use CBLOCK (and certainly not EQU) to give your registers names, but >instead use relocatable code. > >Greetings, >Maarten Hofman. > > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist