i2c stc8a 从设备_注释很详细的IIC做从机发送数据源程序

/*************        用户系统配置        **************/

#define MAIN_Fosc                12000000L        //定义主时钟, 模拟串口和红外接收会自动适应。5~36MHZ

#define D_TIMER0                125                        //选择定时器时间, us, 红外接收要求在60us~250us之间

#define        User_code                0xFD02                //定义红外接收用户码

#define DECVICE_ADD 0x55<<1

/*************        以下宏定义用户请勿修改        **************/

#include        "reg51.H"

#include        "string.H"

#define        uchar        unsigned char

#define uint        unsigned int

//#define freq_base                        (MAIN_Fosc / 1200)

//#define Timer0_Reload                (65536 - (D_TIMER0 * freq_base / 10000))

/*************        本地常量声明        **************/

/*************        本地变量声明        **************/

sbit        SDA = P3^0;                //SDA

sbit        SCL = P3^1;                //SCL

bit                PreState;

bit                NowState;

bit     START_flag;

bit     STOP_flag;

//uchar        IR_SampleCnt;                //采样计数

uchar NN;

uchar DEVICE_ADR;        //器件地址

uchar WORD_ADR;                //内存地址

uchar REC_DATA;                //接收到的内容

unsigned int  *send_ptr;//

code unsigned AA0[9] = {0x70,0x2c,0x6e,0x2a,0x00,0x00,0x00,0xc0};  //

code unsigned AA8[2] = {0xff,0x2c};  //

//code unsigned AA0[9] = {0x70,0x2c,0x6e,0x2a,0x00,0x00,0x00,0xc0};  //

code unsigned A00[33] = {0xed,0xcf,0x48,0xe6,0x89,0xe8,0x0c,0xe8,

0x97,0xaf,0xd2,0x40,0x6d,0xc2,0xc4,0x04,

0xca,0xd5,0xea,0xa7,0xae,0x43,0x37,0xe2,

0x12,0x05,0x3b,0x59,0xb7,0xfb,0x3d,0xa5

};  //

code unsigned A20[33] = {0xCB,0x85,0x8b,0x54,0x6d,0x97,0x3c,0x05,

0x46,0x0f,0x45,0xb4,0xd1,0x0a,0xb8,0x9b,

0xdf,0xa2,0x43,0x8d,0xe6,0x7a,0x6f,0xf8,

0x7f,0xaa,0x52,0x37,0xa6,0x8f,0xdc,0x71

};  /

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值