Exact match. Not showing close matches.
'[PIC]: 'F87xx Config Programming'
Now that I've gotten one of the new Flash PIC chips (16F872), I
wanted to program it. As indicated by an email by Jim Robertson, my WARP-3
and MacPic will program the 'F872, by selecting the 'F84 as the chip to be
programmed. But it cannot program all the bits in the config register, and
I would like to put it into HVP mode to liberate RB3. So I looked at Tony
Nixon's RomZap, and saw that it used the PICs special address and data
registers to program the Flash Program Memory.
I wrote a program that should have set the config reg to 0x3F3D.
But when I checked with TM4 it showed the bits still at 0x3FF1. I also then
loaded a flasher program that increments port B, and only pins RB0-2
oscillate as they should, the ones above these are low.
Is what I'm trying to do possible or have I done something wrong in
the program ?
The wording in DS30221 page 110 seems to preclude this, but then it
says "...LVP bit can only be charged when using high voltage on ~MCLR." So
this seems it might be possible since I am "discharging" the LVP bit, or is
My program follows.....
;======= Flash_PROM_Config_reg_Demo ===================== 6/6/2000 ==
; This program will use the special registers within the 'F872
; to set the Config register.
; This can be checked with TM4 on the Compaq
list p=16F84 ; used since there is no 16F872
; this already means that MacPic
; cannot be used to program the
; config register, and may mean that
; that the full 2K of the 'F872 may
; not be accessable for programming
; cpu equates (memory map)
indf equ 0x00 ; indirect addressing Reg
tmr0 equ 0x01 ; Timer/Counter register
pcl equ 0x02 ; program counter (low byte)
status equ 0x03 ; status reg
fsr equ 0x04 ; file select register
porta equ 0x05 ; port A
portb equ 0x06 ; port B
portc equ 0x07 ; port C
; Note these registers are on page 1
opt_reg equ 0x01 ; MPU Option Register
trisa equ 0x05 ; Data Direction Port A
trisb equ 0x06 ; Data Direction Port B
trisc equ 0x07 ; Data Direction Port C
; Note these registers are on page 2
EEData equ 0x0C ; EEPROM Data reg
EEDataH equ 0x0E ; EEPROM Data reg high byte
EEAdr equ 0x0D ; EEPROM Address reg
EEAdrH equ 0x0F ; EEPROM Address reg high byte
; Note these registers are on page 3
EECon1 equ 0x0C ; EEPROM Control reg 1
EECon2 equ 0x0D ; EEPROM Control reg 2
; bit equates
rp0 equ 0x05 ; bank select low bit
rp1 equ 0x06 ; bank select high bit
zBit equ 0x02 ; Zero flag
rd equ 0x00 ; EEPROM read control bit
wr equ 0x01 ; EEPROM write control bit
wren equ 0x02 ; EEPROM write enable bit
eepgd equ 0x07 ; Flash EPROM write enable bit
LED equ 0x04 ; pin for LED
bsf status,rp0 ; switch to bank 1
movlw b'00000000' ; outputs
bcf status,rp0 ; switch back to bank 0
movlw 0xFF ; all Port A & B outputs high
movwf porta ;
; setup Flash PROM to set config reg at 0x2007
bsf status,rp1 ; switch to bank 2
movlw 0x20 ; initialize EEPROM address to
movwf EEAdrH ; config register
movlw 0x3F ; initialize config register
movwf EEDataH ; data to 0x3F3D
movlw 0x3D ; HV programming only
bcf status,rp1 ; switch back to bank 0
call WriteEEPROM ; load value into EEPROM
bcf portA, LED ; turn LED on (diagnostic)
goto LoadDone ; just wait here
; **** NOTE THIS STILL MUST BE UPDATED FOR 'F872 operation ***
; on entry addressPtr holds the address of the EEPROM to be read
; on exitdataPtr holds the data that was read
; Address and data already set-up
; Note that normally the set-up would be done here from
; a 16bit data buffer (actually 14bit), and a 16bit address pointer
bsf status, rp0 ; page select, page 3
bsf status, rp1 ;
bsf EECon1, eepgd ; point to flash (program) memory
bsf EECon1, wren ; enable write
movlw 0x55 ; send 'magic' numbers to
movwf EECon2 ; EEPROM Control reg 2
bsf EECon1, wr ; initiate write command
; btfsc EECon1, wr ;Spec sheets show this as not necessary
; goto WriteCompl ;
; write is now complete
bcf status, rp0 ; switch back to page 0
bcf status, rp1
;at blast time, select:
; memory unprotected
; Debug disabled
; Flash Program Memeory write enabled
; Data EE Code protection off
; Low Voltage Programming disabled
; Brown-out reset disabled
; watchdog timer disabled (default is enabled)
; standard crystal XT
; (using 4 MHz osc for test)
; power-up timer on
Heinz Czychun wrote:
> Hi All,
> Now that I've gotten one of the new Flash PIC chips (16F872), I
> wanted to program it. As indicated by an email by Jim Robertson, my WARP-3
> and MacPic will program the 'F872, by selecting the 'F84 as the chip to be
> programmed. But it cannot program all the bits in the config register, and
> I would like to put it into HVP mode to liberate RB3. So I looked at Tony
> Nixon's RomZap, and saw that it used the PICs special address and data
> registers to program the Flash Program Memory.
ROMzap can program the config word when you boot program a blank chip by
using the simple programmer interface.
I don't think you can program the config word internally.
Not what I wanted to hear, but better that, than go too far down a
At 3:04 PM 6/7/2000, Tony Nixon wrote:
Wow, alot of changes to ROMzap since January.
The 'F872 doesn't have a hardware async port. Will ROMzap still
program the config register of this PIC? And what connections are needed to
the PIC ?
Heinz Czychun wrote:
> Wow, alot of changes to ROMzap since January.
Updated again today.
> The 'F872 doesn't have a hardware async port. Will ROMzap still
> program the config register of this PIC? And what connections are needed to
> the PIC ?
I didn't even know the 872 existed. I will try to add bit banging
support for it and also for the F870/1 chips.
I am using the 16F873 and program the config fully with my MPLAB software
and the PICSTART PLUS. In *.inc file contains all the names of the various
config bits. I found that the low voltage name in the inc file is LVE
(rather than that listed which I don't recall...LVF, LVP?). Seems to work
fine. I haven't looked at the 872? but if it is like the 873, remember to
turn off the A/D converter since it is set ON at POR unless configured OFF.
Also, turn LVE OFF.
Hope that helps.
On Wednesday, June 07, 2000 12:05 AM, Tony Nixon
[SMTP:ENG.MONASH.EDU.AU] wrote: Tony.Nixon
> Heinz Czychun wrote:
> > Hi All,
> > Now that I've gotten one of the new Flash PIC chips (16F872), I
> > wanted to program it. As indicated by an email by Jim Robertson, my
> > and MacPic will program the 'F872, by selecting the 'F84 as the chip to
> > programmed. But it cannot program all the bits in the config register,
> > I would like to put it into HVP mode to liberate RB3. So I looked at
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- New search...