CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Issues with 44 Pin demonstration Board and PIC16F887

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dblk22vball



Joined: 28 May 2010
Posts: 2

View user's profile Send private message

Issues with 44 Pin demonstration Board and PIC16F887
PostPosted: Fri May 28, 2010 6:05 am     Reply with quote

I have the 44 pin demonstration board from Microchip, which has a PIC16F887 chip on it. I am using the PicKit 2 programmer.

I am just trying to do a simple "flash the led" program, but it seems like the cpu is not even running. I have also tried turning on an output on each port, but none of them change.

Below is my code I am using.

Code:
#include <16F887.h>
#fuses NOMCLR          //Do not use Master Clear
#fuses NOBROWNOUT      //No brownout reset
#fuses LP            // low power osc
#fuses NOWDT         //no watchdog timer
#fuses NOCP            //no code protect
#fuses NOCPD         //no EE protection
#fuses NOIESO         //Internal External Switch over mode disabled
#fuses NOFCMEN         //Fail Safe clocl monitor disabled
#fuses PWRT            //Power up timer
#fuses nodebug         //no debug for IDE
#use delay(clock=32000)
#use FAST_IO(D)


void main()
{
    setup_adc_ports(NO_ANALOGS);
//   setup_adc(ADC_CLOCK_INTERNAL);
    setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED, 0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_CCP1(CCP_OFF);
   setup_CCP2(CCP_OFF);
   //setup_vref(FALSE);
   output_high(PIN_C1);
   output_high(PIN_A1);
   output_high(PIN_B1);
   //ENABLE_INTERRUPTS(INT_RTCC);
   SET_TRIS_D(0);
   SET_TRIS_c(0);
   SET_TRIS_b(0);


while(true)
    {
        output_high(PIN_D1);
      output_high(PIN_D0);
      delay_ms(1000);
      output_low(PIN_D1);
      output_low(PIN_D0);
      delay_ms(1000);
    }

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 28, 2010 11:26 am     Reply with quote

Download the 44-Pin Demo Board User’s Guide:
http://ww1.microchip.com/downloads/en/DeviceDoc/41296b.pdf
Look at the schematic on page 35 (page 39 in the Acrobat reader).
It shows two crystals. On the left side, crystal 'X1' is 10 MHz, and it's
connected to the main oscillator pins. That's the one you should be
using.

Download the 16F887 data sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/41291F.pdf
Look in the Oscillator section:
Quote:

4.0 OSCILLATOR MODULE (WITH
FAIL-SAFE CLOCK MONITOR)

It says that LP mode is used for a 32 KHz crystal. They don't tell you,
but for a 10 MHz crystal you need to use 'HS' mode.

Quote:

#fuses LP

#use delay(clock=32000)

To fix your program, change the fuse above to 'HS' and change the
#use delay() to 4 MHz.
dblk22vball



Joined: 28 May 2010
Posts: 2

View user's profile Send private message

PostPosted: Fri May 28, 2010 11:56 am     Reply with quote

Thank you for the reply.

Correct, there are pads for X1 and X2, but they are not populated.

I figured out that part of my problem was that you cannot have the pickit connected to the board, even though it says it can power the board. once you disconnect the pickit, you can get it to work.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 28, 2010 12:07 pm     Reply with quote

If they're not populated, then you could use the internal oscillator of the
PIC. Use the INTRC_IO fuse for this. Look in the PIC data sheet
(oscillator section) to see the frequencies that are available.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group