Why Does My PIC16F723A Show a Programming Error in MPLAB X?

In summary, the speaker is working with a PIC16F723A chip and is trying to program it to toggle a pin (RA1) on and off. They have the circuit setup correctly and are using MPLAB X IDE v1.70 on OS X version 10.8.2. The project configuration is setup with the device of PIC16F723A, hardware tools of ICD 3, and compiler toolchain as XC8. They are getting an error and a warning message when trying to program the chip and have checked the circuit design and chip multiple times. The speaker has successfully programmed other chips with the same setup but is having trouble with the PIC16F723A. They have also tried using multiple chips.
  • #1
zxcvb
10
1
I am working with a PIC16F723A chip and I am trying to program it to toggle a pin (RA1) on and off. I am pretty sure I have the circuit setup correctly (below is what I have setup), but for some reason I get an error when trying to program it...

So, I am using MPLAB X IDE v1.70 on OS X version 10.8.2. The project configuration in MPLAB X is setup with the device of PIC16F723A, hardware tools of ICD 3, and compiler toolchain as XC8 (Location: /Applications/microchip/xc8/v1.12/bin). There is no supported plugin board. It is NOT setup to power the target circuit from the ICD 3.

The error I am getting is "Connection Failed.If the problem persists, please disconnect and reconnect the ICD 3 to the USB cable. If this does not fix the problem verify that the proper MPLAB X USB drivers have been installed."

The warning I am getting is "CAUTION: Check that the device selected in MPLAB IDE (PIC16F723A) is the same one that is physically attached to the debug tool. Selecting a 5V device when a 3.3V device is connected can result in damage to the device when the debugger checks the device ID. Do you wish to continue?"

Here is how I have the circuit setup...
PIC16F723A PIN 1 is connected to ICD3 MCLR PIC16F723A PIN 28 is connected to ICD3 ICSPDAT PIC16F723A PIN 27 is connected to ICD3 ICSPCLK PIC16F723A PIN 1/ICD3 MCLR is connected to external VDD (+3.3V) through a 10K resistor (I have also tried a 4.7K) PIC16F723A PIN 8 is connected to PIC16F723A PIN 19 PIC16F723A PIN 19 is connected to GND PIC16F723A PIN 20 is connected to VDD (+3.3V)

I am checking the chip using a Tektronix Oscilloscope and when I continue from the warning message, I see data being transferred on the ICSPDAT pin, but nothing has changed for the RA1 pin.

Here is the code I am using:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <pic16f723.h>

void main(void){
     int i = 0;
     TRISAbits.TRISA1 = 0; // RA1 to output
     ANSELAbits.ANSA1 = 0; // RA1 to Digital I/O

     while(1){
         PORTAbits.RA1 = 1;
         for(i = 0; i < 1000; i++);
         PORTAbits.RA1 = 0;
         for(i = 0; i < 1000; i++);
     }
}
I have checked the circuit design several times, I have checked to make sure the chip is correct (the silkscreen on it says PIC16F723A-I/SP 1142D3V). I have also tried programming it by supplying +3.3V from an external supply and a +5.0V from an external supply.

Here is the schematic:
gQyPU.png

Where I have attached an oscilloscope to SCOPE

I have tried the ICD3 test interface board and it came back saying everything is working correctly:
Test interface PGC clock line write succeeded.

Test interface PGD data line write succeeded.

Test interface PGC clock line read succeeded.

Test interface PGD data line read succeeded.

Test interface LVP control line test succeeded.

Test interface MCLR level test succeeded.

ICD3 is functioning properly. If you are still having problems with your target circuit please check the Target Board Considerations section of the online help.I have been able to successfully program a PIC16F1824 chip with this programmer and computer. I am using a PIC16F723A because I needed more I/O pins than the PIC16F1824 has. I have also used this computer to successfully program a Cerebot MX4cK. For some reason the PIC16F723A doesn't want to work. If I haven't mentioned it before, I have tried multiple chips.

Here is the PIC16F723A chip which was bought from http://www.kynix.com/Detail/406028/PIC16F723AT-I/SS.html
PIC16F723AT-I2fSS_439402.jpg
 
Last edited by a moderator:
  • Like
Likes berkeman
Engineering news on Phys.org
  • #2
Perhaps the compiler has optimized your loops away since they are doing anything useful.

One test would be to run the program setting the value high and then run it again to set it low or see if there is a sleep function that you can use in place of the loops.
 
  • #3
Test if you are in control of the output port external pin or if it is still an input or a disabled tristate output.
To test it, connect the oscilloscope to the pin.
Use a 10k pull-up resistor from the pin to Vcc. Does it show close to Vcc on the oscilloscope ?
Use the 10k resistor to pull-down to ground. Does it show near zero on the oscilloscope ?
If so it is still an input.
You should now know if your TRIS register is correctly set.
 

1. How do I get started with PIC16F723A programming?

To get started with PIC16F723A programming, you will need to have a basic understanding of C programming language and microcontroller concepts. You can also refer to the manufacturer's datasheet and user manual for specific instructions on programming the PIC16F723A microcontroller.

2. What tools do I need for programming PIC16F723A?

You will need a PIC programmer, a computer, and a programming software such as MPLAB or CCS C Compiler. Some PIC programmers also come with their own software. You may also need a breadboard, components, and a power supply for testing your code.

3. Is there a specific IDE for programming PIC16F723A?

There is no specific IDE (Integrated Development Environment) for programming PIC16F723A. However, you can use MPLAB or CCS C Compiler as they offer a user-friendly interface and support for various microcontrollers including PIC16F723A.

4. Can I use Arduino IDE for programming PIC16F723A?

No, Arduino IDE is not compatible with PIC16F723A. It is designed for programming Arduino boards which use a different microcontroller. You will need to use a software that is specifically designed for PIC microcontrollers.

5. What are some common programming challenges with PIC16F723A?

Some common programming challenges with PIC16F723A include configuring the microcontroller's internal oscillator, setting up the configuration bits, and understanding the different memory types and their uses. It is also important to properly handle interrupts and implement efficient coding techniques to optimize the use of the limited resources on the microcontroller.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Electrical Engineering
Replies
6
Views
1K
Replies
4
Views
1K
  • Sticky
  • Programming and Computer Science
Replies
13
Views
4K
  • Electrical Engineering
Replies
1
Views
2K
Replies
6
Views
3K
Replies
6
Views
6K
  • Programming and Computer Science
Replies
4
Views
5K
Replies
1
Views
5K
Replies
7
Views
6K
Back
Top