注册 登录
电子工程世界-论坛 返回首页 EEWORLD首页 频道 EE大学堂 下载中心 Datasheet 专题
lanyu345的个人空间 https://home.eeworld.com.cn/space-uid-33208.html [收藏] [复制] [分享] [RSS]
日志

LPC1114 接64Mb FLASH 程序与图片,须完善

已有 1264 次阅读2010-5-7 16:26

编的程序 , 有待完善 , 共同探讨!!!!! 顺便 秀一下 MAQ PC91 的无线耳麦, 下午刚到!!!共同交流!!! extern void WRITE_M_BYTE(uint8_t M_BYTE ) //write instruction to flash { uint8_t j,commd; flash_cs0; asm("nop"); asm("nop"); flash_sclk0; for(j=0;j<8;j++) { commd=(M_BYTE>>j)%2; if(commd==0x01) { flash_din1; } else flash_din0; flash_sclk1; //the instructions are latched on the rising edge //of serial clock asm("nop"); asm("nop"); asm("nop"); asm("nop"); flash_sclk0; asm("nop"); asm("nop"); } } extern uint8_t READ_M_BYTE() //read one byte from flash { uint8_t i ,R_flash_data; for(i=0;i<8;i++) { asm("nop"); asm("nop"); dr= LPC_GPIO[PORT3]->MASKED_ACCESS[(1<<0)]; dr=(dr>>8)%2; din[0]=dr; if(din[0]==0x01) { R_flash_data<<=1; R_flash_data|=0x01; } else { R_flash_data<<=1; R_flash_data|=0x00; } flash_sclk1; //data is shifted out on the falling edge of //serial clock. asm("nop"); asm("nop"); asm("nop"); asm("nop"); flash_sclk0; asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop"); } return R_flash_data; } extern void flash_busy() //busy or not { uint8_t busy=0x01; flash_cs1; WRITE_M_BYTE(RDSR) ; //Read status register instruction do{ busy=0x01; busy=READ_M_BYTE() ; //Read status byte. busy&=0x01; } while(busy==0x01); flash_cs1; asm("nop"); asm("nop"); asm("nop"); asm("nop"); } extern void R_gps_flash(uint8_t count,uint8_t *address) //read the gps information form flash { uint8_t i; WRITE_M_BYTE(WREN) ; //write Enable instruction; flash_busy(); //busy or not flash_cs1; WRITE_M_BYTE(READ); write_flashadd(address); //WRITE THE INITIAL ADDRESS FOR READING for(i=0;i
评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册