久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標題:
PMC234+AT24C01程序源碼
[打印本頁]
作者:
yaoyangui
時間:
2017-11-10 10:45
標題:
PMC234+AT24C01程序源碼
PMC234 + AT24C01 程序源碼,直接可用
所有資料51hei提供下載:
pmc234_24c01.rar
(17.78 KB, 下載次數(shù): 12)
2017-11-10 10:44 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
單片機源程序如下:
#include "extern.h"
/***********************************************************************************************/
void at24cxx_Delay_5us( void );
void at24cxx_Delay_10us( void );
void at24cxx_Delay_10ms( void );
void AT24CXX_IO_Init( void );
void AT24CXX_CLK_LOW( void );
void AT24CXX_CLK_HIGH( void );
void AT24CXX_IO_LOW( void );
void AT24CXX_IO_HIGH( void );
void at24cxx_IO_input( void );
void at24cxx_IO_ouput( void );
void at24cxx_Start( void );
void at24cxx_Stop( void );
void at24cxx_SEND_ACK( void );
void at24cxx_SEND_NACK( void );
void at24cxx_RECV_ACK( void );
void at24cxx_Recv_Char( void );
void at24cxx_Send_Char( void );
void read_Random_Byte( void );
void write_Random_Byte( void );
void read_eeprom_configuration( void );
void write_eeprom_configuration( void );
/***********************************************************************************************/
void FPPA0 (void)
{
.ADJUST_IC SYSCLK=IHRC/2, IHRC=16MHz, VDD=5V, Bandgap=On;
// Insert Initial Code
AT24CXX_IO_Init();
while (1)
{
// ...
// wdreset;
read_eeprom_configuration();
write_eeprom_configuration();
}
}
void FPPA1 (void)
{
goto $;
}
void Interrupt (void)
{
pushaf;
if (Intrq.T16)
{ // T16 Trig
// User can add code
Intrq.T16 = 0;
//...
}
popaf;
}
/******************************************************/
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void at24cxx_Delay_5us( void )
{
.delay 100;
}
void at24cxx_Delay_10us( void )
{
.delay 200;
}
void at24cxx_Delay_10ms( void )
{
.delay 200;
.delay 200;
.delay 200;
.delay 200;
.delay 200;
}
/***********************************************************************************************/
void AT24CXX_IO_Init( void )
{
//SCL
PA.0 = 1;
PAC.0 = 1;
//SDA
PA.5 = 1;
PAC.5 = 0;
}
/***********************************************************************************************/
void AT24CXX_CLK_LOW( void )
{
PA.0 = 0;
}
void AT24CXX_CLK_HIGH( void )
{
PA.0 = 1;
}
/***********************************************************************************************/
void AT24CXX_IO_LOW( void )
{
PA.5 = 0;
}
void AT24CXX_IO_HIGH( void )
{
PA.5 = 1;
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void at24cxx_IO_input( void )
{
PAC.5 = 0;
}
void at24cxx_IO_ouput( void )
{
PAC.5 = 1;
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void at24cxx_Start( void )
{
at24cxx_Delay_10us();
at24cxx_IO_input();
AT24CXX_IO_HIGH();
at24cxx_Delay_10us();
AT24CXX_CLK_HIGH();
at24cxx_Delay_10us();
AT24CXX_IO_LOW();
at24cxx_Delay_10us();
AT24CXX_CLK_LOW();
at24cxx_Delay_10us();
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void at24cxx_Stop( void )
{
at24cxx_IO_ouput();
AT24CXX_IO_LOW();
at24cxx_Delay_10us();
AT24CXX_CLK_HIGH();
at24cxx_Delay_10us();
AT24CXX_IO_HIGH();
at24cxx_Delay_10us();
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void at24cxx_SEND_ACK( void )
{
AT24CXX_CLK_LOW();
at24cxx_Delay_5us();
at24cxx_IO_ouput();
AT24CXX_IO_LOW();
at24cxx_Delay_10us();
AT24CXX_CLK_HIGH();
at24cxx_Delay_10us();
AT24CXX_CLK_LOW();
at24cxx_Delay_10us();
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void at24cxx_SEND_NACK( void )
{
AT24CXX_CLK_LOW();
at24cxx_Delay_5us();
at24cxx_IO_ouput();
AT24CXX_IO_HIGH();
at24cxx_Delay_10us();
AT24CXX_CLK_HIGH();
at24cxx_Delay_10us();
AT24CXX_CLK_LOW();
at24cxx_Delay_10us();
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void at24cxx_RECV_ACK( void )
{
AT24CXX_CLK_LOW();
at24cxx_Delay_5us();
at24cxx_IO_input();
at24cxx_Delay_10us();
AT24CXX_CLK_HIGH();
at24cxx_Delay_5us();
iic_retry_times = 200;
iic_ack_flag = 0;
do
{
if( !IIC_SDA_PIN )
{
iic_ack_flag = 1; //sucessful sending
break;
}
at24cxx_Delay_5us();
iic_retry_times--;
}while( iic_retry_times > 0 );
AT24CXX_CLK_LOW();
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void at24cxx_Recv_Char( void )
{
iic_count = 0x08;
at24cxx_IO_input();
at24cxx_Delay_5us();
do
{
iic_recvByte <<= 1;
AT24CXX_CLK_LOW();
at24cxx_Delay_10us();
AT24CXX_CLK_HIGH();
at24cxx_Delay_5us();
if( IIC_SDA_PIN )
{
iic_recvByte |= 0x01;
}
else
{
iic_recvByte &= 0xFE;
}
at24cxx_Delay_5us();
AT24CXX_CLK_LOW();
iic_count--;
}while( iic_count > 0 );
at24cxx_Delay_10us();
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void at24cxx_Send_Char( void )
{
iic_count = 0x08;
at24cxx_IO_ouput();
at24cxx_Delay_5us();
do
{
AT24CXX_CLK_LOW();
at24cxx_Delay_5us();
if( iic_sendByte.7 )
{
AT24CXX_IO_HIGH();
}
else
{
AT24CXX_IO_LOW();
}
iic_sendByte <<= 1;
at24cxx_Delay_5us();
AT24CXX_CLK_HIGH();
at24cxx_Delay_10us();
iic_count--;
}while( iic_count > 0 );
AT24CXX_CLK_LOW();
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void read_Random_Byte( void )
{
iic_rd_successful_flag = 0;
at24cxx_Start();
iic_sendByte = IIC_COMMAND_WRITE;
at24cxx_Send_Char();
at24cxx_RECV_ACK();
if( !iic_ack_flag )
{
iic_rd_successful_flag = 1;
return;
}
iic_sendByte = iic_Address;
at24cxx_Send_Char();
at24cxx_RECV_ACK();
if( !iic_ack_flag )
{
iic_rd_successful_flag = 1;
return;
}
//
at24cxx_Start();
iic_sendByte = IIC_COMMAND_READ;
at24cxx_Send_Char();
at24cxx_RECV_ACK();
if( !iic_ack_flag )
{
iic_rd_successful_flag = 1;
return;
}
//
at24cxx_Recv_Char();
at24cxx_SEND_NACK();
iic_Data = iic_recvByte;
at24cxx_Stop();
}
/***********************************************************************************************
* \brief This function is just used to generate some example data for write operations
* on the card.
*
**********************************************************************************************/
void write_Random_Byte( void )
{
iic_rd_successful_flag = 0;
at24cxx_Start();
iic_sendByte = IIC_COMMAND_WRITE;
at24cxx_Send_Char( );
at24cxx_RECV_ACK();
if( !iic_ack_flag )
{
iic_rd_successful_flag = 1;
return;
}
iic_sendByte = iic_Address;
at24cxx_Send_Char( );
at24cxx_RECV_ACK();
if( !iic_ack_flag )
{
iic_rd_successful_flag = 1;
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
歡迎光臨 (http://www.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
久久久久久99
|
欧美一级淫片免费视频黄
|
中文字幕97
|
中文字幕日韩欧美
|
久久av一区二区三区
|
欧美成人一区二区
|
一区二区免费
|
久久国产精品无码网站
|
国产99久久
|
国产视频亚洲视频
|
国产超碰人人爽人人做人人爱
|
久久久久一区二区三区
|
色爱综合网
|
9999国产精品欧美久久久久久
|
国产91在线精品
|
国产精品免费一区二区三区四区
|
欧美午夜在线
|
国产色在线
|
h视频在线免费
|
亚洲伦理自拍
|
精品三级
|
最新国产视频
|
亚洲激情综合
|
国产激情在线
|
中文字幕 视频一区
|
欧美一区永久视频免费观看
|
澳门永久av免费网站
|
亚洲成人精品一区二区
|
久久免费精品
|
天天躁日日躁狠狠的躁天龙影院
|
a级片在线观看
|
欧美一卡二卡在线观看
|
黄色国产在线播放
|
三级在线视频
|
人人色视频
|
毛片链接
|
99在线资源
|
国产精品免费一区二区三区四区
|
xxxxx免费视频
|
精品三级在线观看
|
a在线观看
|