求助:初始化完成后中斷引腳一直為低電平,讀SSR寄存器為0xFF,讀IIR寄存器也是0xFF。
初始化后寄存器配置如下:為寫入后讀出來的數(shù)據(jù)
IER: 00? IIR: 01? LCR: 00? MCR: 00? LSR: 60? MSR: 00? SCR: ab? FCR: 01
讀寫操作例程如下
void CH438WriteReg(unsigned char add,unsigned char data)
{
SetOutPut();
Writedata(add);
SET_CS_L();
SET_ALE_H();
Ddl_Delay1us(1);
SET_ALE_L();
Writedata(data);
SET_WR_L();
Ddl_Delay1us(1);
SET_WR_H();
SET_CS_H();
}
unsigned char CH438ReadReg(unsigned char addr)?
{
unsigned char value;
SetOutPut();
Writedata(addr);
SET_CS_L();
SET_ALE_H();
Ddl_Delay1us(1);
SET_ALE_L();
SetInPut();
SET_RD_L();
Ddl_Delay1us(1);
value = ReadData();
SET_RD_H();
SET_CS_H();
return value;
}