dspic30f4011 programming pinout

Discussion in 'Embedded Systems and Microcontrollers' started by bassplayer142, May 10, 2010.

  1. bassplayer142

    Thread Starter Active Member

    Jan 2, 2007
    89
    0
    I finally got all my equipment and am ready to program a chip and get something basic running. I have the pickit2 now and it has 6 output pins. I'm not sure what has to be connected to what. The datasheet can be seen below with the pin characteristics on page 12 and 13.

    http://ww1.microchip.com/downloads/en/DeviceDoc/70135F.pdf

    First off, what is the difference of AVdd & AVss with respect to Vdd & Vss? Is the one with A in front of it for powering the chip, and the other one for powering I/O pins? Should I just power and ground them both?

    I don't know what pins to connect the programmer to either. If there is a tutorial somewhere or a datasheet that would be great. Also, I read that the MCLR should be connected to a pullup resistor of 10k.

    Sorry for the many, many questions and thanks in advance.
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
  3. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    The A... ones are power to the ADC, to aid in decoupling and isolation from the logic side. Generally, just connect them to power with the other Vdd & Vss pins.

    The right hand half of this sheet is the best general reference for the ICD pinout & how to connect to an MPU. I stick a copy in each new project file when I start..
    http://ww1.microchip.com/downloads/en/DeviceDoc/51265g.pdf
     
  4. bassplayer142

    Thread Starter Active Member

    Jan 2, 2007
    89
    0
    Thanks for all the help. I finally got a led to blink so at least I know I'm doing something right :). A few more questions.

    1. Why is there three Vss and Vdd pins? Right now I'm grouding and supplying to each of them. Would one suffice?

    2. The code below I found online to configure the clock. The only information from a pdf I could find is below that. I don't understand where these names come from. I'm used to setting a register with a hex value to configure these things. What is the underscore for? Thanks in advance, you guys have been really helpful. :)

    _FOSC(CSW_FSCM_OFF & FRC); //code to config clock

    6.6.1 Configuration Bits Setup Macros
    Macros are provided that can be used to set configuration bits. For example, to set the
    FOSC bit using a macro, the following line of code can be inserted before the beginning
    of your C source code:
    _FOSC(CSW_FSCM_ON & EC_PLL16);
    This would enable the external clock with the PLL set to 16x and enable clock switching
    and fail-safe clock monitoring.
    Similarly, to set the FBORPOR bit:
    _FBORPOR(PBOR_ON & BORV_27 & PWRT_ON_64 & MCLR_DIS);
    This would enable Brown-out Reset at 2.7 Volts and initialize the Power-up timer to 64
    milliseconds and configure the use of the MCLR pin for I/O.
    For a complete list of settings valid for each configuration bit, refer to the processor
    header file.
     
  5. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    Definitely connect all power pins.

    They probably go to different areas of the die, so the internal connection is via the chip.

    While it may work with no I/O loading if one pin is left open, it will probably cause erratic operation or damage once you are using the I/O pins.

    The underscores in variable or constant names are an alternative to spaces, as embedded spaces are not allowed. It's supposed to make the abbreviations more readable, but that is a matter of opinion.

    The _leading underscores are often indicators of special compiler functions or definitions, to minimise the chance of a program variable name conflicting.

    The constant names themselves will be from a compiler header file, probably one specific to the MPU you are using.

    eg. I use the CCS compilers & part of the setup with those is an #include that refers to the processor type number.h near the start of the program.

    That sets up constants for all the register config bits that are specific to the chip you are working with.
     
  6. bassplayer142

    Thread Starter Active Member

    Jan 2, 2007
    89
    0
    I have this line in the beginning.

    #include <p30f4011.h>

    I'm confused because in mplab's box thingy there is only my main.c. I didn't even have to add the file p30f4011.h to the source. Is there some way I can look into that file or a datasheet about it? Thanks.

    edit: Just found the file in a directory, I will take a look into that.
     
  7. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    mplab should add that automatically when you choose the PIC type you are using from the uC selection.
     
  8. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    Yeah, the setup is different for each tool set, I only use MPLab itself for assembly and the CCS PICC compiler as an add-on for C, still working with the MPLab IDE.

    Which compiler are you using?
     
  9. bassplayer142

    Thread Starter Active Member

    Jan 2, 2007
    89
    0
    I'm still unable to understand where these clock statements are coming from. I understand that it is probably in an include somewhere but I can't seem to decipher any of them. For instance I found these both online and set up a delay and toggled an output. I then read it using pickit2 logic tool and found that the clock was still the exact same frequency when the second one should be a 16x multiplier. thanks
    _FOSC(CSW_FSCM_OFF & FRC);

    _FOSC(CSW_FSCM_ON & XT_PLL16);
     
Loading...