| 数据搜索系统,热门电子元器件搜索 |
|
SH7262 数据表(PDF) 21 Page - Renesas Technology Corp |
|
|
|||||||||||||||||||||||||||||
SH7262 数据表(HTML) 21 Page - Renesas Technology Corp |
|
21 / 45 page ![]() SH7262/SH7264 Group High-speed Read/Write Serial Flash Memory Using the Renesas Serial Peripheral Interface REJ06B0889-0100/Rev.1.00 June 2009 Page 21 of 45 3.3 Sample Program Listing "main.c" (3/3) 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 /* ==== Chip erase (2 MB, it takes about 10 seconds to complete) ==== */ sf_chip_erase(); /* ==== Writes data (2 MB, it takes about 10 seconds to complete) ==== */ addr = TOP_ADDRESS; for(i = 0; i < SF_NUM_OF_SECTOR; i++){ /* ---- Initializes the data (64 KB) ---- */ for(j = 0; j < SF_SECTOR_SIZE; j++){ data[j] = (i + j) % 100; } /* ---- Writes one sector (64 KB) data ---- */ for(j = 0; j < ( SF_SECTOR_SIZE / SF_PAGE_SIZE ); j++){ /* ---- Writes one page (256 bytes) data ---- */ sf_byte_program( addr, data+(j*SF_PAGE_SIZE), SF_PAGE_SIZE ); addr += SF_PAGE_SIZE; /* Updates the destination address to write */ } } /* ==== Reads data (2 MB) ==== */ addr = TOP_ADDRESS; for(i = 0; i < SF_NUM_OF_SECTOR; i++){ /* ---- Reads one sector (64 KB) data ---- */ sf_byte_read_long( addr, rbuf, SF_SECTOR_SIZE ); addr += SF_SECTOR_SIZE; /* Updates the source address to read */ /* ---- Verifies data ---- */ p = (unsigned char *)rbuf; for(j = 0; j < SF_SECTOR_SIZE; j++){ data[j] = (i + j) % 100; /* Outputs the written data */ if( data[j] != *(p+j) ){ puts("Error: verify error\n"); fflush(stdout); while(1); } } } /* ==== Protects serial flash memory ==== */ sf_protect_ctrl( SF_REQ_PROTECT ); while(1){ /* loop */ } } /* End of File */ |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |