试图编写一个I2C驱动程序,我在另一个文件中工作,我刚刚移植了这些函数。PIC12LF1840的后端代码是使用MCC创建的。我试图建立与MMA845 2Q加速度计的COMS。我怀疑别针是断开的,但我不完全肯定。这是MCC为PixMealth.C生成的(注意,我使用RC1作为SCL和RC2和SDA)LATA= 0x06;TrISA=0x3f;ANSELA=0x10;WPUA= 0x00;opthyRePix.NWPUEN=0x01;APFCONN=0x00;这些是正确的吗?编辑:如果我做了I2C传输,我的EuStudio写不再工作,如果我没有任何,那么EuStudioWrad将工作。这里是我实现的代码,现在只写一个:MaAdAdabess=0B011100;/7位地址到0Unt88t写缓冲区[U];Unt88t状态;WrreBuffer-[ 0 ]=MMAYCCTLL ReGy1;WrreBuff[1 ]=0B90000;//低噪声,快速读取,最快数据速率I2C.MistWrrad(Read Effice,2,MMAAAD)服饰,地位;= I2CyMasaGug完成; 以上来自于百度翻译 以下为原文 Trying to write an I2C driver that I had working in another file and I just ported over the functions. The back-end code for the PIC12LF1840 was created using MCC. I am trying to set-up coms with a MMA8452q accelerometer. I suspect the pins are off but I am not completely sure. This is what MCC generated for pin_manager.c. (note I am using RC1 as SCL and RC2 and SDA) LATA = 0x06; TRISA = 0x3F; ANSELA = 0x10; WPUA = 0x00;OPTION_REGbits.nWPUEN = 0x01;APFCON = 0x00; Are these correct? edit: If I do an I2C transmission, my EUSART_Write no longer works, and if I don't have any then EUSART_Write will work. Here is my implemented code, only doing one write for now: MMA_Address = 0b0011100; //7-bit address with SA0 pin to 0uint8_t writeBuffer[2]; uint8_t status; writeBuffer[0] = MMA_Ctrl_Reg_1; writeBuffer[1] = 0b00000000; //low-noise, fast-read, fastest data rate I2C_MasterWrite(writeBuffer, 2, MMA_Address, &status); while(status != I2C_MESSAGE_COMPLETE);
2018-12-20 16:17
为何无线蓝牙耳机可以迅速引爆市场呢?与传统耳机相比,TWS无线耳机具有哪些优点?
2021-06-16 09:09