Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).
|
Hi All, I saw a few posts regarding EEPROM routines for the MC9S12DP256 written in assembly. If anyone has a set or example that they are willing to share it would be a great time saver. Actually a routine in C would be ideal but.... Please e-mail me at Thanks in advance, Dave Yanez [Non-text portions of this message have been removed] |
|
|
|
if sombody had it, Pls. send it me too. My mail is wrote:Hi All, I saw a few posts regarding EEPROM routines for the MC9S12DP256 written in assembly. If anyone has a set or example that they are willing to share it would be a great time saver. Actually a routine in C would be ideal but.... Please e-mail me at Thanks in advance, Dave Yanez [Non-text portions of this message have been removed] -------------------------------------------------------- To unsubscribe from this group, send an email to: To learn more about Motorola Microcontrollers, please visit http://www.motorola.com/mcu Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- µðÁöÅ» Ä«¸Þ¶ó¿Í Âû¶± ±ÃÇÕ - ¾ßÈÄ! »çÁø Ä£±¸µé°ú ÇÔ²² ¹Ù²ãº¸¼¼¿ä - ¾ßÈÄ! ¸Þ½ÅÀú [Non-text portions of this message have been removed] |
|
Me too.
----- Original Message ----- From: º´ÁÖ Áø To: Sent: Tuesday, December 10, 2002 5:03 PM Subject: Re: [68HC12] EEPROM routines for MC9S12DP256 if sombody had it, Pls. send it me too. My mail is wrote:Hi All, I saw a few posts regarding EEPROM routines for the MC9S12DP256 written in assembly. If anyone has a set or example that they are willing to share it would be a great time saver. Actually a routine in C would be ideal but.... Please e-mail me at Thanks in advance, Dave Yanez [Non-text portions of this message have been removed] -------------------------------------------------------- To unsubscribe from this group, send an email to: To learn more about Motorola Microcontrollers, please visit http://www.motorola.com/mcu Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- µðÁöÅ» Ä«¸Þ¶ó¿Í Âû¶± ±ÃÇÕ - ¾ßÈÄ! »çÁø Ä£±¸µé°ú ÇÔ²² ¹Ù²ãº¸¼¼¿ä - ¾ßÈÄ! ¸Þ½ÅÀú [Non-text portions of this message have been removed] Yahoo! Groups Sponsor ADVERTISEMENT -------------------------------------------------------- To unsubscribe from this group, send an email to: To learn more about Motorola Microcontrollers, please visit http://www.motorola.com/mcu Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. [Non-text portions of this message have been removed] |
|
Hi Dave, the code below writes a sector (4bytes/2words) to the EEPROM of the DP256. initEETS() must be called once during the initialization phase of your program. This code snippet is part of a new 'DP256 reference design, which I prepared for Motorola recently. The whole stuff (source code and docs) can be downloaded for free from Motorola web. Just go to the ACPRD Project Page and follow the links... Happy HC(S)12ing! Oliver ----------------------------------------------------- *** Oliver Thamm's HC12 Web *** http://hc12web.de *** ----------------------------------------------------- > Hi All, > I saw a few posts regarding EEPROM routines for the MC9S12DP256 written in > assembly. If anyone has a set or example that they are willing to share it > would be a great time saver. Actually a routine in C would be ideal > but.... > Please e-mail me at > Thanks in advance, > Dave Yanez //============================================================================= // File: S12_EETS.C - V1.00 // Rem.: The ACPRD Project Page on the Web -> http://hc12web.de/acprd //============================================================================= //-- Includes ----------------------------------------------------------------- #include "datatypes.h" #include <hcs12dp256.h> #include "s12_eets.h" //-- Code --------------------------------------------------------------------- void initEETS(void) { ECLKDIV = EETS_ECLKDIV; // set EEPROM Clock Divider Register } //----------------------------------------------------------------------------- INT8 wrSectEETS(UINT16 *dest, UINT16 *src) { // check addr: must be aligned 32 bit if((UINT16)dest & 0x0003) return -1; // check if ECLKDIV was written if((ECLKDIV & BM_EDIVLD) == 0) return -2; // make sure error flags are reset ESTAT = BM_PVIOL | BM_ACCERR; // check if command buffer is ready if((ESTAT & BM_CBEIF) == 0) return -3; // check if sector is erased if((*dest != 0xffff) || (*(dest+1) != 0xffff)) { // no, go erase sector *dest = *src; ECMD = EETS_CMD_SERASE; ESTAT = BM_CBEIF; if(ESTAT & (BM_PVIOL | BM_ACCERR)) return -4; while((ESTAT & BM_CBEIF) == 0) ; } // program 1st word *dest = *src; ECMD = EETS_CMD_PROGRAM; ESTAT = BM_CBEIF; if(ESTAT & (BM_PVIOL | BM_ACCERR)) return -5; while((ESTAT & BM_CBEIF) == 0) ; // program 2nd word *(dest+1) = *(src+1); ECMD = EETS_CMD_PROGRAM; ESTAT = BM_CBEIF; if(ESTAT & (BM_PVIOL | BM_ACCERR)) return -6; while((ESTAT & BM_CCIF) == 0) ; return 0; } <snip> //============================================================================= |
|
Thanks, Oliver! I went to Motorola's site and found the source and docs, this is a great help. Oliver Thamm <> 12/11/2002 03:00 AM Please respond to 68HC12 To: cc: Subject: Re: [68HC12] EEPROM routines for MC9S12DP256 Hi Dave, the code below writes a sector (4bytes/2words) to the EEPROM of the DP256. initEETS() must be called once during the initialization phase of your program. This code snippet is part of a new 'DP256 reference design, which I prepared for Motorola recently. The whole stuff (source code and docs) can be downloaded for free from Motorola web. Just go to the ACPRD Project Page and follow the links... Happy HC(S)12ing! Oliver ----------------------------------------------------- *** Oliver Thamm's HC12 Web *** http://hc12web.de *** ----------------------------------------------------- > Hi All, > I saw a few posts regarding EEPROM routines for the MC9S12DP256 written in > assembly. If anyone has a set or example that they are willing to share it > would be a great time saver. Actually a routine in C would be ideal > but.... > Please e-mail me at > Thanks in advance, > Dave Yanez //============================================================================= // File: S12_EETS.C - V1.00 // Rem.: The ACPRD Project Page on the Web -> http://hc12web.de/acprd //============================================================================= //-- Includes ----------------------------------------------------------------- #include "datatypes.h" #include <hcs12dp256.h> #include "s12_eets.h" //-- Code --------------------------------------------------------------------- void initEETS(void) { ECLKDIV = EETS_ECLKDIV; // set EEPROM Clock Divider Register } //----------------------------------------------------------------------------- INT8 wrSectEETS(UINT16 *dest, UINT16 *src) { // check addr: must be aligned 32 bit if((UINT16)dest & 0x0003) return -1; // check if ECLKDIV was written if((ECLKDIV & BM_EDIVLD) == 0) return -2; // make sure error flags are reset ESTAT = BM_PVIOL | BM_ACCERR; // check if command buffer is ready if((ESTAT & BM_CBEIF) == 0) return -3; // check if sector is erased if((*dest != 0xffff) || (*(dest+1) != 0xffff)) { // no, go erase sector *dest = *src; ECMD = EETS_CMD_SERASE; ESTAT = BM_CBEIF; if(ESTAT & (BM_PVIOL | BM_ACCERR)) return -4; while((ESTAT & BM_CBEIF) == 0) ; } // program 1st word *dest = *src; ECMD = EETS_CMD_PROGRAM; ESTAT = BM_CBEIF; if(ESTAT & (BM_PVIOL | BM_ACCERR)) return -5; while((ESTAT & BM_CBEIF) == 0) ; // program 2nd word *(dest+1) = *(src+1); ECMD = EETS_CMD_PROGRAM; ESTAT = BM_CBEIF; if(ESTAT & (BM_PVIOL | BM_ACCERR)) return -6; while((ESTAT & BM_CCIF) == 0) ; return 0; } <snip> //============================================================================= -------------------------------------------------------- To unsubscribe from this group, send an email to: To learn more about Motorola Microcontrollers, please visit http://www.motorola.com/mcu [Non-text portions of this message have been removed] |