Gordon,
I found my problem. I had to check for CBEIF first before checking for
CCIF at the line .PERM5
Mike
----- Original Message -----
From: "Michael J Huslig" <>
To: <>
Sent: Thursday, November 14, 2002 3:02 PM
Subject: Re: [68HC12] EEPROM programming for 9S12A128
> Gordon,
> Could I see them too?
>
> I am using the DP256 and had no problem doing an EEPROM bulk erase and
then
> copying from RAM to EEPROM.
>
> However, after adding a protected sector to the EEPROM, I couldn't do
a
bulk
> erase anymore, so I used the following sector
modify routine. The routine
> compares each sector with the data in RAM. If they are different, I do a
> sector modify followed by a word write. It appears that once the program
> finds a sector that needs changing, it has to change all the following
> sectors. I haven't checked to see whether the sector modify routine
is
> erasing all the following sectors, or whether when I check the next
sector
I
> no longer can read from the EEPROM.
> LDX #USERS_EESTART ;==$400
> LDY #BBRAM1
> .PERM2 LDD 0,X ;CHECK IF SECTOR NEEDS REPROGRAMMING
> CPD 0,Y
> BNE .PERM3
> LDD 2,X
> CPD 2,Y
> BEQ .PERM6
> .PERM3 MOVB #ESTAT.ACCERR+ESTAT.PVIOL,ESTAT
> BRCLR ESTAT,#ESTAT.CBEIF,$
> JSR WATCHDOG
> LDD 0,Y
> STD 0,X
> MOVB #ECMD.ERASE+ECMD.PROGRAM,ECMD ;SECTOR MODIFY
> MOVB #ESTAT.CBEIF,ESTAT
> BRCLR ESTAT,#ESTAT.ACCERR+ESTAT.PVIOL,.PERM4
> SWI
> .PERM4 BRCLR ESTAT,#ESTAT.CBEIF,$
> JSR WATCHDOG
> LDD 2,Y
> STD 2,X
> MOVB #ECMD.PROGRAM,ECMD ;PROGRAM SECOND HALF OF
> SECTOR
> MOVB #ESTAT.CBEIF,ESTAT
> BRCLR ESTAT,#ESTAT.ACCERR+ESTAT.PVIOL,.PERM5
> SWI
> .PERM5
BRCLR ESTAT,#ESTAT.CBEIF,$ ;new line inserted
> BRCLR ESTAT,#ESTAT.CCIF,$
> .PERM6 LEAX 4,X
> LEAY 4,Y
> CPY #BBRAM4
> BLO .PERM2
> RTC
>
> ----- Original Message -----
> From: "Gordon Doughman" <>
> To: <>
> Sent: Thursday, November 14, 2002 10:30 AM
> Subject: Re: [68HC12] EEPROM programming for 9S12A128
> > Gianni,
> >
> > I have a set of routines that I wrote for the Cosmic compiler. It
provides
> > routines that will allow writing a byte, word
or long word to any
address
> > boundary. Essentially the routines allow the
small sector Flash to be
> > treated as byte writeable EEPROM, erasing & (re)writing
information as
> > necessary. I can provide the assembly source but no support. I'm
sure it
> > could be adapted to the icc compiler. Let me know if you're
interested.
> >
> > Regards,
> > Gordon
> >
> > Gianni wrote:
> >
> > > Hello,
> > >
> > > I would like to know if anyone has a "C" callable
routine to program
> > > the EEPROM of a 9S12A128 device.
> > > I'm using ICC12 compiler.
> > >
> > > Thank you very much.
> > >
> > >
> > >
> > > --------------------
> > >
> > >
> > >
> > > ">http://docs.yahoo.com/info/terms/
> >
> > --
> > ===============================================================
> > Gordon Doughman Ph: 937-438-6811
> > Motorola Semiconductor Fax: 937-434-7457
> > Field Applications Engineer Pager: 800-759-8352 Pin: 1304089
> > Suite 175
> > 3131 Newmark Drive
> > Miamisburg, OH 45342
> >
> > Check out my HC12 book at:
> > http://www.rtcgroup.com/books/
> >
> >
> >
> >
> > --------------------
> >
> >
> >
> > ">http://docs.yahoo.com/info/terms/
> >
> >
> >
>
|