Simple problems with PIC24F16KA102

Thread Starter

Peytonator

Joined Jun 30, 2008
105
Hi there,

I just got myself an XLP 16 bit dev board with a PIC24F16KA102 (you can find the datasheet here), and a PICkit3 to program the thing.

I was wondering if you could please help me? I am new to PIC24s and I have a few questions:

  • I put my scope leads between pin 28 (Vdd) and 27 (Vss) and the voltage spikes for less than a second then drops to 0. It happens every time a touch the pin. Why can't I see constant 3.3V? I did check that power is on in MPLAB (at 3.3V), and the demo boards features were active (puts an LED on when you press a button, for e.g.). I also see the power LED of the board is on.
  • The code below to see if I get an oscillator signal out on pin 10 (OSCO). That's all I want to see. I get the signal I have attached. What is the problem? Have I got my config bits wrong?
Rich (BB code):
#include <p24F16KA102.h>

// Configuration Bits - see p24F16KA102.h
_FOSCSEL(FNOSC_FRCPLL & IESO_OFF);        // Fast RC Oscillator  With Postscaler (FRCDIV)
_FOSC (OSCIOFNC_OFF & POSCMOD_EC);       // OSCO Pin Has  Clock Out Function (CLKO), External clock
_FWDT (FWDTEN_OFF);                                     // WDT off

//main loop
int main(void)
{
   //Set up Clock
   OSCCON    =    0x11C0;     //select INTERNAL RC, Post Scale PPL //Fast RC Oscillator with Postscaler and PLL module (FRCPLL)
   //Loop forever
   
while(1)
   {
   }

}
Many thanks
 

Attachments

Thread Starter

Peytonator

Joined Jun 30, 2008
105
In fact, I was trying something even simpler. I just want to make LEDs on the board attached to RB8 and RB15 turn on. My code is:

Rich (BB code):
#include <p24F16KA102.h>

//main loop
int main(void)
{
    TRISB = 0x0000;
    PORTB = 0xFFFF;
   while(1)
   {
   }
}

Nothing turns on. Oh please help!!
 

Thread Starter

Peytonator

Joined Jun 30, 2008
105
Nevermind. It was my poor understanding of how the dev board works. But please could you explain something to me....

  1. When I output a low from RB8 to the LED, the LED goes ON. Why?
  2. When I test the supply voltage using an oscilloscope, it doesn't work, but with a multimeter it does work. Why? How can I then test the output properly using a scope? Like if I want to see the output of an oscillator?
 

t06afre

Joined May 11, 2009
5,934
When I test the supply voltage using an oscilloscope, it doesn't work, but with a multimeter it does work. Why? How can I then test the output properly using a scope? Like if I want to see the output of an oscillator?
This must be your scope settings. You must use the correct volt/div setting and also put the scope in DC mode. A scope has two settings for the input stage. AC and DC. In AC mode the scope will block DC voltage. Like from the PIC power supply. Perhaps some in this forum have a link to a scope basics tutorial. Do a search or ask for it
 
Top