The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C Code
Posted by: Tianshiz | June 19, 2009 @ 10:35am
C Code
[
Download
]
void ReadSerialFlashPage(uint16 PageNum, uint8 *pBuffer) { uint16 i; // Send command packet. SPIputchar(0xd2); // Main Memory Page Read command. SPIputchar((PageNum >> 7) & 0xff); // 0 0 0 0 PA10 PA9 PA8 PA7 SPIputchar((PageNum << 1) & 0xff); // PA6 PA5 PA4 PA3 PA2 PA1 PA0 BA8(=0) SPIputchar(0x00); // BA7..BA0 = 0x00 SPIputchar(0x00); // Don't care. SPIputchar(0x00); // Don't care. SPIputchar(0x00); // Don't care. SPIputchar(0x00); // Don't care. // Copy returned data from flash to RAM. for (i = 0; i < 256; i++) *pBuffer++ = SPIgetchar(); }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.47 / 8
119 Votes
http://codebin.yi.org/306
page generated in 0.01 seconds