找回密码
 注册
搜索
查看: 707|回复: 1

[讨论] 经典问题?

[复制链接]
发表于 2007-12-27 10:18:23 | 显示全部楼层 |阅读模式
?
    /****************************************************************************

??*名称:main()

??*功能:向E2PROM写入10字节数据,然后读出判断是否正确写入。

??*说明:在STARTUP.S文件中使能IRQ中断(清零CPSR中的I位);

??*在CONFIG.H文件中包含I2CINT.H。

??****************************************************************************/

??intmain(void)

??{

??uint8data_buf[10]={

??0x00,

??0x57,

??0x41,

??0x02,

??0xA2,

??0x6A,

??0xA0,

??0x80,

??0x81,

??0x00

??};

??PINSEL0=0x00000050;//设置I/O口工作模式,使用I2C口

??PINSEL1=0x00000000;

??IO0DIR=VIDEO_LED;//设置LED1控制口为输出,其它I/O为输入

??IO0SET=VIDEO_LED;

??I2C_Init();//I2C初始化

??ISendStr(ADV7180,0x00,data_buf,1);//在0x00地址处写入1字节数据

??ISendStr(ADV7180,0x04,data_buf,1);//在0x04地址处写入1字节数据

??ISendStr(ADV7180,0x17,data_buf,1);//在0x17地址处写入1字节数据

??ISendStr(ADV7180,0x31,data_buf,1);//在0x31地址处写入1字节数据

??ISendStr(ADV7180,0x3D,data_buf,1);//在0x3D地址处写入1字节数据

??ISendStr(ADV7180,0x3E,data_buf,1);//在0x3E地址处写入1字节数据

??ISendStr(ADV7180,0x3F,data_buf,1);//在0x3F地址处写入1字节数据

??ISendStr(ADV7180,0x0E,data_buf,1);//在0x0E地址处写入1字节数据

??ISendStr(ADV7180,0x55,data_buf,1);//在0x55地址处写入1字节数据

??ISendStr(ADV7180,0x0E,data_buf,1);//在0x0E地址处写入1字节数据

??DelayNS(1);

??IRcvStr(ADV7180,0x00,data_buf,1);//在0x00地址处读出1字节数据

??IRcvStr(ADV7180,0x04,data_buf,1);//在0x04地址处读出1字节数据

??IRcvStr(ADV7180,0x17,data_buf,1);//在0x17地址处读出1字节数据

??IRcvStr(ADV7180,0x31,data_buf,1);//在0x31地址处读出1字节数据

??IRcvStr(ADV7180,0x3D,data_buf,1);//在0x3D地址处读出1字节数据

??IRcvStr(ADV7180,0x3E,data_buf,1);//在0x3E地址处读出1字节数据

??IRcvStr(ADV7180,0x3F,data_buf,1);//在0x3F地址处读出1字节数据

??IRcvStr(ADV7180,0x0E,data_buf,1);//在0x0E地址处读出1字节数据

??IRcvStr(ADV7180,0x55,data_buf,1);//在0x55地址处读出1字节数据

??IRcvStr(ADV7180,0x0E,data_buf,1);//在0x0E地址处读出1字节数据

??while(1)

??{

??IRcvStr(ADV7180,0x10,data_buf,1);//read2bytesdatafromADV7180at0x10addressusingI2Cport.

??//UART0_SendStr(data_buf);//sendthe2bytesdatatothecomputer,thedatadisplayonthescreen.

??if(data_buf[0]&0x01==1)IO0SET=VIDEO_LED;//检测的信号时ADV7180的寄存器10的最低位IN_LOCK.

??else

??IO0CLR=VIDEO_LED;//若有视频输入,VIDEO_LED引脚为高,否则为低

??DelayNS(100);

??}

??return(0);

??}
 楼主| 发表于 2007-12-27 10:21:55 | 显示全部楼层
问题:
1.data_buf中的值是否能按下边的地址按顺序写入?
2.整个程序运行到死循环位置是否会改变0x00寄存器的中值?
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2024-10-7 14:26 , Processed in 0.044367 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表