Searching \ for '[RE]: Problems with CC5x compiler or 16f877a' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=16F
Search entire site for: 'Problems with CC5x compiler or 16f877a'.

Exact match. Not showing close matches.
PICList Thread
'[RE]: Problems with CC5x compiler or 16f877a'
2007\02\01@114203 by Rich Satterlee

flavicon
face

Hi-

I am not familiar with the KIT182A, so YMMV.

Might I suggest that you take a look at pin 1 of the PIC?  ~MCLR should be pulled
high.  You didn't mention it in your post.  Typically a 10K resistor to Vdd will
do the trick.

With ~MCLR not high, the PIC will remain in reset.

Hope this helps.

 Cheers,

   Rich S.

---- Original Message ----
From:                Paul Lee
Date:                Thu 2/1/07 3:26
To:                spam_OUTpiclistTakeThisOuTspammit.edu
Subject:        Problems with CC5x compiler or 16f877a

Hi,

I am trying to program the 16f877a with the KIT182A but nothing appears at
the output pin. I generated the hex file using the free version of CC5x.

The circuit consists of a XT oscillator and a 40 pin PDIP PIC. The
oscillator output directly connects to the PIC OSC1 pin and the ICSP pins of
the K182A are directly connected to the PIC programming pins. I have added a
0.1uF on the VDD and VSS.

The code is shown below.

#include <16F877a.h>

//Config Register
#pragma config = 0x3F31

bit pwm_int @PORTD.1;

void main(void)
{
   TRISD = 0x00;
   pwm_int = 1;
   while(1)
   {
       pwm_int = !pwm_int;
   }

}

The software display the firmware is programmed correctly.

The problem is that I don't get anything at Pin 20 when I program the PIC. I
hoping to see a continuous one and zero transition but nothing appears at
the output.

Cheers
Paul

2007\02\01@211953 by Paul Lee

picon face
Hi Rich,

I am not very sure if it is the MCLR. I am also using the PIC16F676 and
compile the following code

(code ripped off from http://jos.vaneijndhoven.net/fancntl/index.html)


#include <16F676.h>

  /* config 13,12 have bandgap calibration value */
  #pragma config =0x21c5 /* INTOSC oscillator, with clkout, do BOD, PWRT,
no WDT, no MCLR */
  #pragma config ID=0xfa01

  bit pwm1       @ PORTC.3; // p07:
  bit pwm2       @ PORTC.4; // p06:

  uns8 calibrate_clk( void);

void main(void)
{
   /* PORTC */
   TRISC = 0x07;
   OSCCAL = calibrate_clk(); /* calibrate on-chip oscillator */
   T1CON  = 0x00;
   GIE = 0;    /* no interrupts allowed */

   pwm1= 1;
   pwm2 = 0;

   while (1)
   {
       pwm1 = !pwm1;
       pwm2 = !pwm2;
   }
}

#pragma origin 0x3ff
uns8 calibrate_clk( void)
{
   return 0x3c; // calibrated value, taken from chip read
}

When I measured the pins, I get an oscillating signal. The MCLR is not
pulled high in this circuit but left floating, and PGC has a Vref of 2V
(Similar to http://jos.vaneijndhoven.net/fancntl/index.html). The rest of
the ICSP pins are connected directly to the PIC programming lines. This is
still using the MicroPro and K182. I have also tried setting the pins high
and low and it works fine.

Do you think the PIC16f877a is faulty? I have swapped the PIC with another
sample but it still does the same thing. I don't get anything at the OSC2
pin (fosc/4) when connecting XT crystal. I have previously used a HS
oscillator using 22 pF for the load caps but this time I don't get a clock
coming out of the oscillator.

I have a ICD2 and PICDEM 2 PLUS from a colleague, I placed the PIC16F877A at
U1 and set the configuration bits to used RC oscillator and compile the
following code with PICC-lite.

#include    <pic.h>


void main(void)
{
   TRISD = 0x00;
   PORTD = 0xFF;
   while(1);  //Microchip support told me to plave this while statement

}

The pins at PORT D does not go high.

Any ideas?

Paul


On 2/2/07, Rich Satterlee <.....picKILLspamspam@spam@satterlees.com> wrote:
{Quote hidden}

> -

2007\02\02@212249 by M. Adam Davis

face picon face
Try this program:
www.ubasics.com/files/staticlcd/staticlcd.c
It goes with this article:
http://www.ubasics.com/driving_static_lcds

If you run it without an LCD then most of the pins will oscillate.

Keep in mind that the 16f877 does NOT have an internal oscillator.

Make sure you have done the following:
1. MCLR (pin 1) is pulled HIGH
2. All four power pins are connected correctly - pins (11, 32 --> 5V),
(12, 31, --> GND)
3. Make sure a crystal is connected to pins 13 & 14 with appropiate
capacitors (or an RC circuit if you don't have a crystal - see the
manual)
4. Make sure watch dog timer is off
5. Make sure oscillator configuration word is set correctly (external
crystal, RC, high speed, low speed, etc)
6. Make sure brown out and power up timers are on if available

Once you've checked all those things, see if it works.  If it does,
great!  If not, look at the following:
1. Check the power consumption of the circuit.  It should be consuming
less than a few dozen milliamps.  If it's pulling more than that then
you've got a short, or too many things connected to the I/O.
2. Check the voltage at pins 1, 11, 12, 31, 32 with a voltmeter.  Make
sure they agree with the above checklist and are at GND or 5V.  If
not, fix wiring.
3. Use an oscilliscope to probe pins 13 and 14.  Make sure the
oscillator is running.  If it's not, make sure you've got the
configuration word set up correctly (use the programmer interface
rather than doing it in the program for now), and make sure you've got
a crystal or RC circuit that matches what the data sheet shows.  If
it's stil not oscillating then you may have a bad chip.
4.  Make sure nothing else is connected to the chip.  The fewer things
connected, the easier it is to debug.
5. If all that is checked and it still doesn't work, you may have a
bad chip.  If several of them fail in the same way, then I'd suspect
something else is going on and re-check everything.  PICs are fairly
robust, and take quite a beating before they die.

Good luck!  Let us know how it goes.

-Adam

On 2/1/07, Paul Lee <.....ezigguratKILLspamspam.....gmail.com> wrote:
{Quote hidden}

More... (looser matching)
- Last day of these posts
- In 2007 , 2008 only
- Today
- New search...