CH552/project/examples/DataFlash/Main.C

44 lines
1.8 KiB
C++
Raw Normal View History

2018-10-17 10:44:45 +02:00
/********************************** (C) COPYRIGHT *******************************
* File Name : Main.C
* Author : WCH
* Version : V1.0
* Date : 2017/01/20
* Description : CH554 DataFlash<EFBFBD>ֽڶ<EFBFBD>д<EFBFBD><EFBFBD>ʾʾ<EFBFBD><EFBFBD>
д DataFlash <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַд<EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD> DataFlash <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򣬴<EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*******************************************************************************/
#include "..\Public\CH554.H"
#include "..\Public\Debug.H"
#include "DataFlash.H"
#include "stdio.h"
#include <string.h>
void main( )
{
UINT8 i,m,len;
UINT16 j = 0;
CfgFsys( ); //CH554ʱ<34><CAB1>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mDelaymS(20);
mInitSTDIO( ); //<2F><><EFBFBD><EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>
printf("start ...\n");
while(1){
for(i=0;i<128;i++){ //ѭ<><D1AD>д<EFBFBD><D0B4>128<32>ֽ<EFBFBD>
len = WriteDataFlash(i,&i,1); //<2F><>DataFlash<73><68><EFBFBD><EFBFBD>ƫ<EFBFBD>Ƶ<EFBFBD>ַiд<69><D0B4>i
if(len != 1){
printf("Write Err <20><> = %02x,m = %02x\n",j,(UINT16)m); //д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ
}
}
for(i=0;i<128;i++){ //<2F><>DataFlash<73><68><EFBFBD><EFBFBD>ƫ<EFBFBD>Ƶ<EFBFBD>ַi<D6B7><69>У<EFBFBD><D0A3>
len = ReadDataFlash(i,1,&m);
if((len != 1) ||(m != i)){
printf("Read Err <20><> = %02x, = %02x,addr =%02x ,ֵ= %02x\n",j,(UINT16)(i*2),(UINT16)ROM_DATA_L,(UINT16)m);
} //<2F><>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ
}
printf("$$OK %02x \n",j);
j++;
mDelaymS(100);
}
}