A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
|
Just checking to see if anyone knows of any problem with the microchip method of programming eeprom data (not program) bytes using the method described in the 16f872 datasheet. I can't work out where the problem is, but my code crashes and freezes when I use their example. Wondered if anyone has any tips for success ? Chris |
|
|
|
> Just checking to see if anyone knows of any problem with the > microchip method of programming eeprom data (not program) bytes using > the method described in the 16f872 datasheet. I can't work out where > the problem is, but my code crashes and freezes when I use their > example. Wondered if anyone has any tips for success ? Rule number one: Never, I repeat, never use code examples from Data Sheet. Use code examples from Application Notes :)) I had serious trouble with code examples from 16F872 Data Sheet some 5 years ago. Place data in "ee_data" and address in "ee_adr" and then call EEWrite. Both "ee_data" and "ee_adr" can be in *any* RAM bank. Just copy this to MPLAB and use MPSIM to verify its functionality. Then use EEWrite in your code or change it as you like. PROCESSOR 16F872 __CONFIG b'00110000001001' #INCLUDE "p16f872.inc" RESET_ADR EQU 0x000 RAM_START EQU 0x020 CBLOCK RAM_START ee_data ee_adr ENDC ORG RESET_ADR movlw 1 movwf ee_data clrf ee_adr call EEWrite incf ee_adr, F call EEWrite Loop goto Loop EEWrite banksel ee_data movf ee_data, W banksel EEDATA movwf EEDATA banksel ee_adr movf ee_adr, W banksel EEADR movwf EEADR banksel INTCON l1_eewrite bcf INTCON, GIE btfsc INTCON, GIE goto l1_eewrite banksel EECON1 bcf EECON1, EEPGD bcf EECON1, WRERR bsf EECON1, WREN movlw 55h movwf EECON2 movlw 0AAh movwf EECON2 bsf EECON1, WR nop nop nop nop banksel PIR2 l2_eewrite btfss PIR2, EEIF goto l2_eewrite bcf PIR2, EEIF nop nop banksel EECON1 bcf EECON1, WREN bsf INTCON, GIE bcf STATUS, RP0 bcf STATUS, RP1 return END Please note that after "return" from "EEWrite" you are in RAM bank 0! Do not place "banksel" directive in the same line with "EEWrite" label or MPASM will report error. That's why "banksel" directive is bellow "EEWrite" label!!! EEWrite is taken directly from one of my applications so it is going to work for sure. Regards, Igor |
|
|
|
I've used the 16F872 quite a bit, including writing and reading from EEPROM. I've not had any freezing problems with it, but I did have those symptoms with some 16F627A chips earlier this year. For this, I later found an errata sheet that documented the problem, with a workaround. (I ended up changing to 16F627 chips instead). Perhaps a newer batch of 16F872 chips has this problem? Check the errata sheets to see if you find anything. Cheers, -Neil. On Tuesday 06 July 2004 11:01 am, Chris scribbled: > Just checking to see if anyone knows of any problem with the > microchip method of programming eeprom data (not program) bytes using > the method described in the 16f872 datasheet. I can't work out where > the problem is, but my code crashes and freezes when I use their > example. Wondered if anyone has any tips for success ? > > Chris > > > to unsubscribe, go to http://www.yahoogroups.com and follow the > instructions Yahoo! Groups Links |
|
Hi list Any idea / address where to find some 16C84? Cristian |
|
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.714 / Virus Database: 470 - Release Date: 02-07-04 |
|
|
|
Try http://www.voti.nl, but you don't want that chip, you want a 16f628, same pin layout, more show, lower price. Kees --- Cristian <> wrote: > Hi list > Any idea / address where to find some 16C84? > Cristian > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system > (http://www.grisoft.com). > Version: 6.0.714 / Virus Database: 470 - Release > Date: 02-07-04 __________________________________ |
|
|
Thanks, KeeTry http://www.voti.nl, No 16C84 there. but you don't want that chip, Maybe, but I'm new to pics and I don't know yet how to modify an *.asm file (those OPTION and TRIS). I'd like to modify a free project. Kees |
|
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.714 / Virus Database: 470 - Release Date: 02-07-04 |
|
|
|
You could use the 16F628. They are pin compatible with the 16F84... --- In , Cristian <bip@f...> wrote: > Hi list > Any idea / address where to find some 16C84? > Cristian > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.714 / Virus Database: 470 - Release Date: 02-07-04 |
|
Cristian, There is only one thing you can modify between 16C84 and 16F84 (not 16F84A, which have different programming algorithm), it's the PWRTE bit, configuration word, address 2007, 16C84 datasheet DS445C page 35. on 16F84, PWRTE ON means 0 on 16C84, PWRTE ON means 1 PWRTE is a simple power up timer. If your supply is ok, you don't need to modify nothing in your code The second diference between these two obsolete parts is the RAM memory: 16C84 have 36 bytes of RAM 16F84 have 68 bytes of RAM If you need just one piece I can send you free of charge a 16F84, unfortunately 16C84 there is not anymore. Also 16F628 is pin to pin compatible but you have just to disable the comparator before writting CMCON =7. best regards, Vasile http://surducan.netfirms.com On Sun, 25 Jul 2004, Cristian wrote: > Thanks, Kee > > >Try http://www.voti.nl, > > No 16C84 there. > > >but you don't want that chip, > >you want a 16f628, same pin layout, more show, lower > >price. > > Maybe, but I'm new to pics and I don't know yet how to modify an *.asm file > (those OPTION and TRIS). > I'd like to modify a free project. > > >Kees |
|
> Try http://www.voti.nl,
that's
me :)
>
No 16C84 there.
Try the
16F84A, follow the link to the info page on the Microchip website and get the
'upgrade' document (maybe also the c84 to f84 upgrade document on the f84 page). The
F84(A) is a;most upwards compatible with the C84, the cgance that you run into any trouble
is very small. But YMMV.
But
after that forget about C84/F84/F84A and switch to newer chips, like the
F628A.
Wouter van Ooijen |