易截截图软件、单文件、免安装、纯绿色、仅160KB

LPC1343读写SPI FLASH at25f1024

自己写的程序,希望对大家有帮助,其实这片flash十分的悲剧,只有4个block,1MB的空间,长期放可执行代码用的,短期放数据,十分的不合适...
void DelayTime( void )
{
u8 i ;
for( i = 0 ; i < 10 ; i++ ) ;
}
void atWriteCmd( u8 cmd )
{
SSPSend( &cmd , 1) ;
}
void atWriteData(u8 * buf , u32 nBytes )
{
if( nBytes == 0 )
return ;
SSPSend( buf , nBytes );
}
void atReadData( u8 *buf , u32 nBytes )
{
if( nBytes == 0 )
return ;
SSPReceive( buf , nBytes ) ;
}
void atSendWREN()
{
atEnable();
atWriteCmd( CMDWREN ) ;
atDisable();
DelayTime();
}
u8 atReadRDSR( )
{
u8 stu ;
atEnable();
atWriteCmd(CMDRDSR);
atReadData( &stu , 1);
atDisable();
return stu ;
}
void atFlashInit( void )
{
LPC_IOCON->PIO1_10 &= ~0x07; /* SSP SSEL is a GPIO pin */
GPIOSetDir( PORT1, 10, 1 );
GPIOSetValue( PORT1, 10, 1 );
LPC_IOCON->PIO1_11 &= ~0x07; /* SSP SSEL is a GPIO pin */
GPIOSetDir( PORT1, 11, 1 );
GPIOSetValue( PORT1, 11, 1 );
SSPInit();
}
void atReadID( u8 * buf)
{
atEnable();
atWriteCmd(CMDRDID);
atReadData( buf , 2 ) ; // 0x1f
atDisable();
}
void atReadFlash(u32 addr , u8 * buf , u32 nBytes )
{
u8 cmd[4] ;
if( nBytes == 0 )
return ;
cmd[0] = CMDREAD ;
cmd[1] = addr>>16 ;
cmd[2] = addr>>8 ;
cmd[3] = addr ;
while( (atReadRDSR()&0x01 ) != 0x00 );
atEnable();
atWriteCmd( cmd[0] );
atWriteCmd( cmd[1] );
atWriteCmd( cmd[2] );
atWriteCmd( cmd[3] );
atReadData( buf , nBytes );
atDisable();
}
void atWriteFlash( u32 addr, u8 * buf , u32 nBytes )
{
u8 cmd[4];
if( nBytes == 0 )
return ;
if( nBytes < 256 )
{// if big than 256 , error Occur
atSendWREN();
while( (atReadRDSR()&0x02 ) != 0x02 ); // write enable
cmd[0] = CMDPROGRAM ;
cmd[1] = addr>>16 ;
cmd[2] = addr>>8 ;
cmd[3] = addr ;

atEnable();
atWriteCmd( cmd[0] );
atWriteCmd( cmd[1] );
atWriteCmd( cmd[2]


相关文档:

Flash中步入Matrix函数

在字典中的说明不够充分让大家去理解,所以开始还是要重复说明一下。Matrix矩阵就像个数组,排列方式是以列与行组
成。在flash 8中所提供的是3 x 3矩阵,3x3的矩阵可以定义出一个3D计算,但在Flash 8中只供2D的计算,即 x 和 y
的计算,那么我们来看看这个矩阵的定义
 


以上的每个字母都有各自 ......

关于flash性能优化的好书

  这本书主要是讲性能优化的!总共只有 85页,蛮少的@^_^ !  废话不多说:
目录
Introduction
Conserving memory
Minimizing CPU usage
ActionScript 3.0 performance
Rendering performance
Optimizing network interaction
Working with media
SQL Database performance
Benchmarking and d ......

小心flash的垃圾回收功能

对于需要累计执行的特效或对象,如tween,他是在给定的时间内不断运行,一旦在函数中定义tween 函数结束时,可能会回收了tween 造成tween不能跑完,定要注意,错误代码如下: 尤其是函数中定义的 package {
        import flash.display.Sprite;
    & ......

flash与php结合实现IP及归属地查询

数据库是 纯真数据库 格式为 UTF-8  txt格式
php文件是UTF-8编码 
demo :      http://dreamnight.gicp.net/zendphp/IP/connect.swf
flash端:
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.ProgressEvent;
//i ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号