LEARNdsPIC

  • Home
  • Tutorials
    • Programming in C
    • Introduction
    • Pinout & Block Diagram
    • LCD (Parallel Interface)
    • IC - Input Capture
    • I2C - Inter Integrated Circuit
    • ADC
    • PWM
  • About
  • Contact
  • Blog/Comments Page
  • Home
  • Tutorials
    • Programming in C
    • Introduction
    • Pinout & Block Diagram
    • LCD (Parallel Interface)
    • IC - Input Capture
    • I2C - Inter Integrated Circuit
    • ADC
    • PWM
  • About
  • Contact
  • Blog/Comments Page

Introduction

Being 16-bit microcontrollers doesn't mean the PIC24/dsPIC has to be orders of magnitude more difficult to learn than 8-bit microcontrollers. In fact, their increase in complexity is more in the area of the numerous peripherals than it is in the larger word size.

These lessons assume familiarity with microcontrollers in general; as well as a basic knowledge of the C programming language. Assembly language will be incorporated into these lessons as time permits, so its familiarity will also make learning easier.


These lessons are specific to the dsPIC33FJ64GP802. Variations with other dsPICs should not be an issue since most have fewer features/peripherals. dsPICs and PIC24s are essentially the same except for the DSP engine so relating these lessons to the PIC24 should not be a problem.

Be aware that these are 3.3V devices. Using 5V will destroy them.

Characteristics:
VDD = 3.0V to 3.6V (Data will be lost of VDD falls below 1.8V)
Maximum device current = 250mA
Maximum current source/sink on any I/O pin = 8mA
Maximum current simultaneously on all I/O pins = 200mA.

These lessons start with the simple circuit shown below. Switch SW1 allows for manual resets of the µC (microcontroller) if desired; switch SW2 provides a means of simple input when the lessons get that far. This switch is located on pin 16 (RB7) since this pin also serves as an external interrupt input (INT0) so we won't have to move it when we get to that lesson.


The four LEDs are sufficient for demonstrating simple digital outputs. The number of LEDs (on RB12 ro RB15) could easily be expanded to eight (including RB8 to RB11) without moving switch SW2.

R1 pulls the active low MCLR (pin 1) high so the device will execute program instructions unless intentionally reset. While I am sure a smaller value resistor could be used, the value of 50k is specified by MicroChip. R2 could be replaced with an internal pull-up resistor once we have covered how to so do.

C2 and C3 are power supply filter capacitors. C1 (VCAP) is the CPU filter capacitor. All capacitors should be placed as close to the device pins as possible.

Since our device has analog features, the analog power supply must be connected whether or not those features are used or the µC will not operate properly. AVDD and AVSS are the power connections referred to.
Picture
Picture



The dsPIC is powered by 3.3V. If you do not a reliable 3.3V source, add this 3.3V regulator circuit to give you the proper voltage. If your VCC is greater than 5V, you should heat sink the regulator.



Picture

A male header is used for programming and in-circuit debugging with the PICKIT3. Pin 1 of the header should face toward pin 1 of the µC ​so wires can be kept as short as possible.

Pin 6 is not connected; the programmer has 6 sockets so we use a matching header even though only 5 pins are used.


It is recommended that you download the datasheet for your specific device. The Family Reference Manual for your device family is also recommend. Throughout these lesson, relevant information from both of these resources will be referenced as appropriate.

If you wish to comment on this page, please do so here.

Copyright 2016