如题,CH438Q,读写数据时序问题,时钟无法使INI#拉低
读写寄存器代码如下:
UINT8 ReadCH438Data( UINT8 addr ) { u8 value; CH438_DATA_PORT->ODR = (CH438_DATA_PORT->ODR&0XFF00)|addr; CH438_ALE_HIGH; CH438_CS_LOW; CH438_ALE_HIGH; CH438_ALE_LOW; CH438_DataPin_IN(); CH438_RD_LOW; CH438_RD_LOW; value = (uint8_t)CH438_DATA_PORT->IDR; CH438_RD_HIGH; CH438_ALE_HIGH; CH438_CS_HIGH; CH438_DataPin_OUT(); return value; }
void WriteCH438Data( UINT8 addr, UINT8 dat) { CH438_DATA_PORT->ODR = (CH438_DATA_PORT->ODR&0XFF00) | addr; CH438_ALE_HIGH; CH438_CS_LOW; CH438_ALE_HIGH; CH438_ALE_LOW; CH438_DATA_PORT->ODR = (CH438_DATA_PORT->ODR&0XFF00) | dat; //?????? delay_us(1); CH438_WR_LOW; CH438_WR_HIGH; CH438_ALE_HIGH; CH438_CS_HIGH; CH438_DataPin_OUT(); }
热门产品 :
CH641: PD及无线充电专用MCU