完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
大家好,我正在尝试PIC16F18854使用ES2C模块使用I2C。ESP是主控,PIC是从机。在PIC控制器中使用MCC生成的代码。地址检测正在发生,但PIC不应对来自ESP的I2C数据,在串行端口中可以看到地址检测,但是通过ESP发送的数据不显示。我不知道哪里出了问题。有人帮助创建PIC16F18854的从属代码。谢谢AlMuu
以上来自于百度翻译 以下为原文 Hi guys I am trying PIC16f18854 to work with esp module using i2c. esp being master and pic being the slave. used MCC generated code in pic controller. address detection is happing but the pic in not coping the i2c data from esp. I can see in serial port the address detection but the data what I am sending through esp is not showing. I am not getting where am going wrong. somebody help to create slave code for pic16f18854. Thanks all Mayu |
|
相关推荐
13个回答
|
|
|
张贴你使用的代码怎么样,这样我们就可以看到你做了什么…
以上来自于百度翻译 以下为原文 How about posting the code that you used, so we can see what you did... |
|
|
|
|
|
很少的信息是很难得到帮助的。发布你的代码,你可能会得到帮助。这里的任何人都很难为你编写完整的代码。
以上来自于百度翻译 以下为原文 It's difficult to get help with little information. Post your code then you might get assistance. It's difficult for anybody here to write the full code for you. |
|
|
|
|
|
我不需要完整的代码,我从MCC插件生成的代码和我使用的代码一样。如果有人处理过MCC生成的I2C代码或者有任何示例代码,那么我需要很少的帮助来完成我的代码。代码M张贴。我是第一个从ESP开始的地址,他们两次写,一个是EEPROM的BW地址,下一个是数据。但是PIC不是在输入数据。定义了I2C1SLaveEX地址0x08,定义了I2C1SLaveEf掩码0x7fTyPulfEnUM {SLaveY-NealthyDATA,SLaveY-DATAAL地址,SLaveWWrdEnEdAdAyType;易失性UIT88T I2C1SLaveWreDeDATA=0x55;无效I2C1YSTATESULCALBACK(I2C1SLaveEx DRIVILION I2CY BuSUBSTATE);无效I2C1ILICALIZE(空){//初始化硬件/ /SMP标准速度;CSP1STAT= 0x80;//SSPN启用;CSPP禁用;SSP1 CON1= 0x26;/ACKEN禁用;GCEN禁用;笔禁用;ACKDT确认;RSEN禁用;RCEN禁用;SEN禁用;SSP1CON2= 0x00;//SBCDE;禁用;BOEN禁用;PCIE禁用;DHEN禁用;SDAHT 100NS;AHEN禁用;SSP1CON3= 0x00;//SSPMSK 127;SSP1MSK =(I2C1SLaveEyMask&L.<1);/ /调整UI掩码为R/NW位//SSPADD 8;SSP1ADAD=(I2C1SLaveEX地址和lt;lt;1);/调整R/NW位/ /的UI地址清除从中断标志Pr3BITS.SSP1IF=0;/ /启用主中断PIE3BITS.SSP1IE=1;}无效I2C1YISR(空隙){UIT88T I2CYDATA=0X55;/Note:从属驱动程序将始终确认/ /或任何地址匹配。PrI3BITS.SSP1IF=0;/ /清除从中断标志I2CyDATA=SSP1BUF;//读取SSPBUF以清除BF IF(1=SSP1STATBITS .RYNW){if((1=SSP1STATBIT.DYNA)和AMP;(1=SSP1CON2BIT.ACKSTAT){{//回调例程)可以执行任何后读取处理I2C1YSTATUSTCALLACK(I2C1SLaveEx Read SypCl)}{//CalpRead例程应将数据写入SSPBUF I2C1YSTATISULCALBACK(I2C1SLaveE.Read请求);}否则(0=SSP1STATBITS.DYNA){//这是I2C地址/ /回调例程应准备从主I2C1YSTATUS回调接收数据(I2C1SLaveWrWrreEngRead请求);} {I2C1SLaveWordEdAt= I2CyDATA;//回调例程应从主I2C1YSTATESCALLBACK(I2C1SLaveWrRead Error完成)处理I2C1SLaveWrad EDATA;} SSP1CON1BITS.CKP=1;//释放SCL}//端I2C1IISR()空I2C1StaseSCALLBACK(I2C1SLaveEI DRIVILION I2CY BuSUBSTATE){静压UIT88T EEPROMSPUBUffer[] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, 0x70,0x71,0x72,0x73,4,0x76,0x78,0x79,0x79,0x7a,0x7c,0x7d,0x7d,0x7e,0x7f};静态uTn8St SLaveWrreType=SLaveEngEngRoad数据;交换机(I2CbBuSuthStand){CaseI2C1SLaveWrWrreEngRead://主将发送EEPROM地址下一个SLaveWrreType=SavaveDATAY地址;BRIA. 0xx案例I2C1SLaveWrWreWEX完成:交换机(SLaveWreDype):EEPROMENTATION = I2C1SLaveWrad Dead;Sturn;SLaveEnEngimoDATA数据:默认值://主机有写入数据存储在EEPROM EEPROMETH缓冲器[EEPROMEDATION++] = I2C1SLaveWreDeDATA;a)(sieOf(EEPROMPEGROM)& lt;=EEPROMENT地址){EEPROM地址} 0;//开始EEPROM页中断;}//Stand开关(SLaveWrreType)SLaveWrreType=SlaveEngRead数据;Stage;I2C1SLaveE.Read请求:SSP1BUF=EEPROMETHOLD [EEPROMEDATION+++ ];IF(SIEPROFF缓冲器)& lt;= EEPROMADEclipse)EEPROM地址=0;//Eclipse启动EEPROM页};案例I2C1SLaveE.Read完成:默认:;//Enter开关(I2cBuSuthStand)}空main(空隙){StaseIn RealAlgIsIe();中断TypGraceDebug();而(1){}}空缺LeDyLink(UIT88T数据){if(data=0x80){Le0}=Re0;γ-DelayyMS(500);}空隙中断中断(中断)管理器(空隙){//中断处理程序if(iNCONTITES.PEI= 1){if(Py3BITSSP1IE=1和&;PIP3BITS.SSP1IF=1){I2C1YISR());否则{{//未处理中断}} { / /未处理中断}}
以上来自于百度翻译 以下为原文 I don't want full code, I generated the code from MCC plugin The same code I am using. if somebody had worked on I2c code generated from MCC or had any example code then I want little help to complete my code. code m posting. i am seding address first from esp and they two times write i.e. one will bw address of eeprom and next will be data. but pic is not intrpriting the data. #define I2C1_SLAVE_ADDRESS 0x08 #define I2C1_SLAVE_MASK 0x7F typedef enum { SLAVE_NORMAL_DATA, SLAVE_DATA_ADDRESS, } SLAVE_WRITE_DATA_TYPE; volatile uint8_t I2C1_slaveWriteData = 0x55; void I2C1_StatusCallback(I2C1_SLAVE_DRIVER_STATUS i2c_bus_state); void I2C1_Initialize(void) { // initialize the hardware // SMP Standard Speed; CKE disabled; SSP1STAT = 0x80; // SSPEN enabled; CKP disabled; SSPM 7 Bit Polling; SSP1CON1 = 0x26; // ACKEN disabled; GCEN disabled; PEN disabled; ACKDT acknowledge; RSEN disabled; RCEN disabled; SEN disabled; SSP1CON2 = 0x00; // SBCDE disabled; BOEN disabled; SCIE disabled; PCIE disabled; DHEN disabled; SDAHT 100ns; AHEN disabled; SSP1CON3 = 0x00; // SSPMSK 127; SSP1MSK = (I2C1_SLAVE_MASK << 1); // adjust UI mask for R/nW bit // SSPADD 8; SSP1ADD = (I2C1_SLAVE_ADDRESS << 1); // adjust UI address for R/nW bit // clear the slave interrupt flag PIR3bits.SSP1IF = 0; // enable the master interrupt PIE3bits.SSP1IE = 1; } void I2C1_ISR ( void ) { uint8_t i2c_data = 0x55; // NOTE: The slave driver will always acknowledge // any address match. PIR3bits.SSP1IF = 0; // clear the slave interrupt flag i2c_data = SSP1BUF; // read SSPBUF to clear BF if(1 == SSP1STATbits.R_nW) { if((1 == SSP1STATbits.D_nA) && (1 == SSP1CON2bits.ACKSTAT)) { // callback routine can perform any post-read processing I2C1_StatusCallback(I2C1_SLAVE_READ_COMPLETED); } else { // callback routine should write data into SSPBUF I2C1_StatusCallback(I2C1_SLAVE_READ_REQUEST); } } else if(0 == SSP1STATbits.D_nA) { // this is an I2C address // callback routine should prepare to receive data from the master I2C1_StatusCallback(I2C1_SLAVE_WRITE_REQUEST); } else { I2C1_slaveWriteData = i2c_data; // callback routine should process I2C1_slaveWriteData from the master I2C1_StatusCallback(I2C1_SLAVE_WRITE_COMPLETED); } SSP1CON1bits.CKP = 1; // release SCL } // end I2C1_ISR() void I2C1_StatusCallback(I2C1_SLAVE_DRIVER_STATUS i2c_bus_state) { static uint8_t EEPROM_Buffer[] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f, 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f, 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f, 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f }; static uint8_t eepromAddress = 0; static uint8_t slaveWriteType = SLAVE_NORMAL_DATA; switch (i2c_bus_state) { case I2C1_SLAVE_WRITE_REQUEST: // the master will be sending the eeprom address next slaveWriteType = SLAVE_DATA_ADDRESS; break; case I2C1_SLAVE_WRITE_COMPLETED: switch(slaveWriteType) { case SLAVE_DATA_ADDRESS: eepromAddress = I2C1_slaveWriteData; break; case SLAVE_NORMAL_DATA: default: // the master has written data to store in the eeprom EEPROM_Buffer[eepromAddress++] = I2C1_slaveWriteData; LED_blink(I2C1_slaveWriteData); if(sizeof(EEPROM_Buffer) <= eepromAddress) { eepromAddress = 0; // wrap to start of eeprom page } break; } // end switch(slaveWriteType) slaveWriteType = SLAVE_NORMAL_DATA; break; case I2C1_SLAVE_READ_REQUEST: SSP1BUF = EEPROM_Buffer[eepromAddress++]; if(sizeof(EEPROM_Buffer) <= eepromAddress) { eepromAddress = 0; // wrap to start of eeprom page } break; case I2C1_SLAVE_READ_COMPLETED: default:; } // end switch(i2c_bus_state) } void main(void) { SYSTEM_Initialize(); INTERRUPT_GlobalInterruptEnable(); INTERRUPT_PeripheralInterruptEnable(); while (1) { } } void LED_blink(uint8_t Data) { if(Data == 0x80){ LED0 = ~LED0; __delay_ms(500); } } void interrupt INTERRUPT_InterruptManager (void) { // interrupt handler if(INTCONbits.PEIE == 1) { if(PIE3bits.SSP1IE == 1 && PIR3bits.SSP1IF == 1) { I2C1_ISR(); } else { //Unhandled Interrupt } } else { //Unhandled Interrupt } } |
|
|
|
|
|
这是一个奴隶代码,请帮帮我。任何示例代码OS PIC都是SOLVE。
以上来自于百度翻译 以下为原文 it is a slave code please help me. any example code os pic being salve. |
|
|
|
|
|
1。您似乎没有把SCK,SDA作为输入引脚。
以上来自于百度翻译 以下为原文 1. You don't seem to have made SCK,SDA as input pins. |
|
|
|
|
|
2、该控制器具有外围引脚选择功能。
以上来自于百度翻译 以下为原文 2.This controller has peripheral pin select functionality. |
|
|
|
|
|
引脚定义为in /Out-Bee MCC,它在PiNangMangle部分,我没有张贴配置过去只I2C部分我张贴代码
以上来自于百度翻译 以下为原文 pins are defined as in/out bye MCC its there in pin_manger part I didn't post the configuration past only the i2c part I posted the code |
|
|
|
|
|
嗨,Mayur,如果你把你的应用程序代码发送到PIC I2C从机,这将是有用的。我已经尝试了MCC生成的I2C从代码到PIC16F1937与MCP2221 I2C终端程序,可以从http://WW1.Microchip下载/ En/DeViceOC/MCP2221Teal.z下载。IPMCC产生的I2C从驱动程序模拟EEPROM设备。使用MCP2221 I2C终端程序,我能够编写多个字节来仿真EEPROM,并将这些字节读回终端程序。下面是对我的测试设置的描述:-MCC生成的I2C从代码在PIC16F1937—MCP22上运行。21 I2C终端程序在笔记本电脑上运行(模拟I2C主控器)- MikRelelktRoNokA UB-I2C点击板用于连接笔记本电脑USB与PIC16F1937 DeVICEI已经附上了终端程序的屏幕截图和从属侧MCC生成代码供您参考。谢谢,Abhijeet
以上来自于百度翻译 以下为原文 Hi Mayur, It will be useful if you post/attach your application code which is trying to send data to PIC I2C slave. I have tried MCC generated I2C Slave code for PIC16F1937 with MCP2221 I2C Terminal program which can be downloaded from http://ww1.microchip.com/downloads/en/DeviceDoc/MCP2221Terminal.zip MCC generated I2C slave driver emulates an EEPROM device. Using MCP2221 I2C Terminal program, I was able to write multiple bytes to emulated EEPROM and read those bytes back to terminal program. Below is the description of my test setup: - MCC generated I2C Slave code is running on PIC16F1937 - MCP2221 I2C Terminal program is running on laptop (To simulate I2C Master) - MikroElektronika USB-I2C click board is used to connect laptop USB with PIC16F1937 device I have attached screenshot of terminal program and slave side MCC generated code for your reference. Thanks, Abhijeet Attached Image(s) Attachment(s) 1937_i2c_slave.zip (34.05 KB) - downloaded 92 times |
|
|
|
|
|
你好,Mayur,你也可以参考附加的MCC生成的I2C主从代码(对于PIC16F1937),在这个例子中,I2C主机将写字节、写块和读块命令发送给I2C从机,这是一个仿真EEPROM。我希望现在你可以把这个代码与你从ESP主控器复制数据的逻辑联系起来。GH PIC I2C从状态机被设计为一个仿真EEPROM,它将很容易修改它为您的ESP主逻辑。谢谢,Abhijeet
1937年I2C.Mist.Zip(45.62 KB)-下载78次 以上来自于百度翻译 以下为原文 Hi Mayur, You can also refer attached MCC generated I2C master-slave code (For PIC16F1937) In this example, I2C master sends writeByte, writeBlock and readBlock commands to I2C slave which is an emulated EEPROM. I hope you can now correlate this code with your logic of copying data from ESP master. Though PIC I2C slave state machine is designed to work as an emulated EEPROM, it will be very easy to modify it for your ESP master specific logic. Thanks, Abhijeet Attachment(s) 1937_i2c_slave.zip (34.09 KB) - downloaded 102 times 1937_i2c_master.zip (45.62 KB) - downloaded 78 times |
|
|
|
|
|
|
|
|
|
|
|
嗨,道歉,劫持这个线程,我试图启动我自己的帖子,但出于某种原因,它没有张贴(可能是因为我是一个新用户)我有问题使用PIC18F2231作为I2C从机工作。我使用的是一个实际的控制器(不是模拟器)和一个模拟发现2的协议分析器作为I2C主机。我所遇到的第一个问题是,α-Primar配置看起来不像预期的那样工作,当这些代码被包含在代码中时,微控制器什么也不做,但是WHE。N是注释出来的,LED闪闪发光。下一个问题是(S.PracMMA配置注释),如果SSPCON寄存器设置为0x36(从7位地址从属),代码永远不会进入SLaveE-RC函数,但是如果将其设置为0x3e(从7位地址从属)启用NTRULTS),然后跳转到SLaveE-RC函数,而不管从“主”发送的地址。另外,当SLaveE-RC函数被调用时,它会被卡住,等待缓冲区填充(LA1导通),而不管我是否发送读或写命令。我有点困惑为什么它不起作用,以及它是如何工作的,从手册上说,SSPIF是在地址匹配之后设置的,所以我并不完全是实际发生的。从模拟发现2 I2C主控器输出,用于读写(带有从属地址)。S设为H18)为:H30[H18[WR] NAK,H01 NAK,STESTORT,H31 [H18-RD] NAK,HFF NAK,STACE和从属码:
以上来自于百度翻译 以下为原文 Hi, Apologies for hijacking this thread, I've tried to start my own post, but for some reason it didn't post (possibly because I'm a new user?) I am having issues using a pic18f2331 to work as an i2c slave. I am using an actual controller (not a simulator) and the protocol analyser of an Analog Discovery 2 as the i2c Master. The first issue I'm having, is the #pragma configuration doesn't appear to work as expected, when these are included in the code the micro-controller just does nothing, however when they are commented out, the LEDs flash as expected. The next issues I am having (#pragma configuration commented out) is that if the SSPCON register is set to 0x36 (slave with 7bit address) the code never makes it to the slave_rec function, however if this is set to 0x3E (slave with 7bit address interrupts enabled) then it jumps to the slave_rec function regardless of the address sent from the "master". Additionally when the slave_rec function is called it gets stuck waiting for the buffer to fill (LA1 LED on) regardless of whether I am sending a Read or Write command. I'm a bit confused as to why this isn't working and also as to how it is supposed to work, as from the manual it says that the SSPIF is set after an address match, so I'm not entirely what is actually happening. The output from the Analog Discovery 2 I2C master, for read and write (with slave address set to h18) is: Start, h30 [ h18 | WR ] NAK, h01 NAK, Stop Start, h31 [ h18 | RD ] NAK, hFF NAK, Stop And the Slave Code: #include //CONFIG1H #pragma config OSC = HS #pragma config FCMEN = OFF #pragma config IESO = OFF //CONFIG2L #pragma config PWRTEN = ON #pragma config BOREN = OFF #pragma config BORV = 45 //CONFIG2H #pragma config WDTEN = OFF #pragma config WDPS = 32768 #pragma config WINEN = OFF //CONFIG3L #pragma config PWMPIN = OFF #pragma config LPOL = HIGH #pragma config HPOL = HIGH #pragma config T1OSCMX = OFF //CONFIG3H #pragma config MCLRE = OFF //CONFIG4L #pragma config STVREN = ON #pragma config LVP = OFF #pragma config DEBUG = OFF //CONFIG5L #pragma config CP0 = OFF #pragma config CP1 = OFF //CONFIG5H #pragma config CPB = OFF #pragma config CPD = OFF //CONFIG6L #pragma config WRT0 = OFF #pragma config WRT1 = OFF //CONFIG6H #pragma config WRTC = OFF #pragma config WRTB = OFF #pragma config WRTD = OFF //CONFIG7L #pragma config EBTR0 = OFF #pragma config EBTR1 = OFF //CONFIG7H #pragma config EBTRB = OFF #define _XTAL_FREQ 8000000 #define slave_address 0x18 unsigned short cmd = 0x00; unsigned short buf_clr = 0x00; void init() { //Oscillator Control Register OSCCON = 0x76; //Pin Direction Register TRISA = 0x00; //0000 0000 (outputs) TRISB = 0x00; //0000 0000 (outputs) TRISC = 0x30; //0011 0000 (outputs, RC4, RC5 inputs for I2C) ANSEL0 = 0x00; //I2C SSPSTAT = 0x00; //00RR RRRR SSPCON = 0x36; //0011 1110 SSPADD = slave_address; //0001 100x (Slave 1, temp address) //Interrupt Enable Bits //RCONbits.IPEN = 1; INTCONbits.GIE = 1; INTCONbits.PEIE = 1; PIR1bits.SSPIF = 0; PIE1bits.SSPIE = 1; } int main(int argc, char** argv) { init(); while(1) { LATAbits.LA1 = 1; LATCbits.LC6 = 1; __delay_ms(500); LATAbits.LA1 = 0; LATCbits.LC6 = 0; __delay_ms(500); //main program loop... } return 0; } void interrupt slave_rec() { LATAbits.LA1 = 0; LATCbits.LC6 = 0; if(PIR1bits.SSPIF == 1) { if((SSPCONbits.SSPOV) || (SSPCONbits.WCOL)) { buf_clr = SSPBUF; SSPCONbits.SSPOV = 0; SSPCONbits.WCOL = 0; SSPCONbits.CKP = 1; } if(!SSPSTATbits.R_nW) { buf_clr = SSPBUF; while(!SSPSTATbits.BF){ LATAbits.LA1 = 1;} //wait for buffer to fill cmd = SSPBUF; LATAbits.LA1 = 0; } if(SSPSTATbits.R_nW) { SSPCONbits.CKP = 0; SSPBUF = 0x0a; SSPCONbits.CKP = 1; PIR1bits.SSPIF = 0; LATCbits.LC6 = 1; while(SSPSTATbits.BF){} } if(cmd == 0x01){LATAbits.LA0 = 1;} if(cmd == 0x02){LATAbits.LA0 = 0;} PIR1bits.SSPIF = 0; } return; } |
|
|
|
|
|
消息12是一个复制:HTTPS://www. McCHIP.COM/FUMMS/FUNDSPED/105432。该消息也被复制到那里。HI Stu,调试I2C从代码可能是棘手的,尤其是如果您不能同时控制主控器。在实时的情况下,主可以认为奴隶没有响应,并且在消息12中的代码中给出配置设置,即:如果真的有一个晶体恰好连接到PIC18F2231,如果你不确定,那么它是一个更简单更安全的SEL。也可以进入调试器,即使晶体振荡器没有连接或不工作。在上面的代码中MCLRE的设置是错误的,我不知道在进入调试器时MPLAB是否会重写它。地址不匹配。你应该试试:MysIL。
以上来自于百度翻译 以下为原文 Message #12 is a duplicate of: https://www.microchip.com/forums/FindPost/1054432 This message have also been copied there. Hi Stu, Debugging I2C slave code may be tricky, especially if you cannot control the Master at the same time. When you stop the slave in debugger, it will not respond to the master in real time, so master may think slave is not responding, and give up Among configuration settings in code in message #12, there is: #pragma config OSC = HS This only make sense if there really is a Crystal properly connected to the PIC18F2331 If you are not sure, then #pragma config = IRCIO // Internal oscillator block, port function on RA6 and port function on RA7 is a much simpler and safer selection. Also: #pragma config FCMEN = ON // Fail-Safe Clock Monitor enabled #pragma config IESO = ON // Internal External Switchover mode enabled Then it might be possible to enter Debugger, even if Crystal oscillator were not connected or not working. Setting for MCLRE is wrong in code above, I don't know if MPLAB will override it when entering debugger. Use: #pragma config MCLRE = ON // MCLR Pin Enable bit, must be ON for Debugging to be possible Mode 36 The most common reason for I2C slave not responding to Address, is that the address do not match. You should try: SSPADD = slave_address << 1; Mysil |
|
|
|
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
503 浏览 0 评论
5812 浏览 9 评论
2350 浏览 8 评论
2237 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3544 浏览 3 评论
1159浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1121浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
888浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
503浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-13 22:49 , Processed in 1.288967 second(s), Total 98, Slave 80 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1677