Simple problems with PIC24F16KA102

Discussion in 'Embedded Systems and Microcontrollers' started by Peytonator, May 13, 2011.

  1. Peytonator

    Thread Starter Active Member

    Jun 30, 2008
    105
    3
    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?
    Code ( (Unknown Language)):
    1. #include <p24F16KA102.h>
    2.  
    3. // Configuration Bits - see p24F16KA102.h
    4. _FOSCSEL(FNOSC_FRCPLL & IESO_OFF);        // Fast RC Oscillator  With Postscaler (FRCDIV)
    5. _FOSC (OSCIOFNC_OFF & POSCMOD_EC);       // OSCO Pin Has  Clock Out Function (CLKO), External clock
    6. _FWDT (FWDTEN_OFF);                                     // WDT off
    7.  
    8. //main loop
    9. int main(void)
    10. {
    11.    //Set up Clock
    12.    OSCCON    =    0x11C0;     //select INTERNAL RC, Post Scale PPL //Fast RC Oscillator with Postscaler and PLL module (FRCPLL)
    13.    //Loop forever
    14.    
    15. while(1)
    16.    {
    17.    }
    18.  
    19. }
    Many thanks
     
  2. Peytonator

    Thread Starter Active Member

    Jun 30, 2008
    105
    3
    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:

    Code ( (Unknown Language)):
    1.  
    2. #include <p24F16KA102.h>
    3.  
    4. //main loop
    5. int main(void)
    6. {
    7.     TRISB = 0x0000;
    8.     PORTB = 0xFFFF;
    9.    while(1)
    10.    {
    11.    }
    12. }

    Nothing turns on. Oh please help!!
     
  3. Peytonator

    Thread Starter Active Member

    Jun 30, 2008
    105
    3
    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?
     
  4. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    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
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    Recheck the schematic and note how D2 & D3 are connected.
     
Loading...