主控芯片是stc8G,poe芯片是MP3924,为什么我读取POE芯片的ADC通道的寄存器值一直是FF
2024-6-8 15:40 来自 becomeAGeneral 发布 @ 综合讨论
#include "STC8h.h"
#include "usart.h"
#include "delay.h"
#include "stdio.h"
#include "intrins.h"
sbit SDA = P1^4;
sbit SCL = P1^5;
unsigned char Register_Data;
bit busy;
void I2C_Isr() interrupt 24
{
// _push_(P_SW2);
P_SW2 |= 0x80;
if (I2CMSST & 0x40)
{
I2CMSST &= ~0x40; //?????
busy = 0;
}
// _pop_(P_SW2);
}
void Start()
{
busy = 1;
I2CMSCR = 0x81; //??START??
while (busy);
}
void SendData(char dat)
{
I2CTXD = dat; //?????????
busy = 1;
I2CMSCR = 0x82; //??SEND??
while (busy);
usart_send_char(busy);
}
void RecvACK()
{
busy = 1;
I2CMSCR = 0x83; //???ACK??
while (busy);
}
char RecvData()
{
busy = 1;
I2CMSCR = 0x84; //??RECV??
while (busy);
return I2CRXD;
#include "usart.h"
#include "delay.h"
#include "stdio.h"
#include "intrins.h"
sbit SDA = P1^4;
sbit SCL = P1^5;
unsigned char Register_Data;
bit busy;
void I2C_Isr() interrupt 24
{
// _push_(P_SW2);
P_SW2 |= 0x80;
if (I2CMSST & 0x40)
{
I2CMSST &= ~0x40; //?????
busy = 0;
}
// _pop_(P_SW2);
}
void Start()
{
busy = 1;
I2CMSCR = 0x81; //??START??
while (busy);
}
void SendData(char dat)
{
I2CTXD = dat; //?????????
busy = 1;
I2CMSCR = 0x82; //??SEND??
while (busy);
usart_send_char(busy);
}
void RecvACK()
{
busy = 1;
I2CMSCR = 0x83; //???ACK??
while (busy);
}
char RecvData()
{
busy = 1;
I2CMSCR = 0x84; //??RECV??
while (busy);
return I2CRXD;
- 最近查阅:
免责声明:
本平台旨在开源共享精神,请勿发布敏感信息,任何违法信息我们将移交公安机关;
上一篇: 关于字寄储器