PART 2: Flash write gt60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

PART 2: Flash write gt60

1,799 次查看
RChapman
Contributor I
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
 
 
Posted: Wed Oct 26, 2005 8:54 am    
 
Hello,
I suppose You use Codewarrior

You can save the routine ERASE_COM,WR_DATA_COM (included in the zip file form motorola) in a file .asm, for example Flash_Utility.asm in your project.

In another file (Flash.c) you can write the function like this

Code:
void Flash_Byte_Write(byte Data,unsigned int Address){ 
  //write to flash 
  .
  .
  .
  asm{   
    ldhx Address
    lda Data
    jsr WR_DATA_COM
  }
  .
  .
  .
}
 
void Flash_Page_Erase(unsigned int Address){ 
  asm{   
    ldhx Address   
    jsr ERASE_COM
  }     
}


One function is for erase the flash page and another one in for write a byte. Remember that You can Always Erase the page and then write the correct byte in that page.

OK ?

Message Edited by RChapman on 01-24-2006 02:24 PM

标签 (1)
0 项奖励
0 回复数