728x90

728x90

Showing posts with label dsPIC. Show all posts
Showing posts with label dsPIC. Show all posts

Friday, July 25, 2025

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer

Overview

dsPIC30F2010 is a 16-bit Digital Signal Controller from Microchip Technology. This 28-pin PICMicro has a 10-bit ADC module with up to 1MSPS conversion rate. It able to operates up to 30MIPs.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Soldered PCBA

 

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
dsPIC30F2010-20I/SP I have

 

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
dsPIC30F2010-30I/SO I have

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer

 

dsPIC30F1010 is 16-bit Digital Signal Controller enhanced for SMPS application. It has a 10-bit ADC module with the conversion speed up to 2000kSPS. It also able to operate up to 20MIPs.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
A dsPIC30F2010 DIP

 
A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
A dsPIC30F1010 DIP

 

These DIP micro-controllers can easily prototype on a breadboard. However we can create a simple prototype board for these chip from scratch. I designed a prototype board for these chips with a PICKit2 programmer to make it self and easier to prototype.

Circuit Design

I use Protues VSM to design the schematics for this board. Most of parts are already have in Protues while other parts are downloaded from snapeda website.

I putted some major modules on this board:

  1. PICKit2 programmer
  2. dsPIC30F2010 and dsPIC30F1010 IC socket
  3. RS-232 to TTL converter
  4. ADC inputs
  5. Switches inputs,
  6. LEDs outputs
  7. Male header for external connection

 

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Schematic Sheet #1


A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Schematic Sheet #2


A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Schematic Sheet #3

 I use three A4 size sheet of this design.

PCB Design

Protues PCB design is very easy to use and light weight. It also have a 3D preview tool and Gerber file exporting and viewing tool. 

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
PCB Design in Protues
 

This PCB is approximately 10cmx10cm in size. I use two layers of copper because it is convenience. Furthermore this size of PCB is very low cost to fabricate using any popular PCB manufacturer such as PCBWay

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Top Copper

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Bottom Copper

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Top Silk
 

It's difficult to fabricate this double-side PCB at home using a CNC machine or toner transfer method. This PCB can be fabricate at very low cost by many PCB manufacturers.

PCB Fabrication

I have been using PCBWay for many years now. PCBWay fabricate PCBs at low cost, fast processing time for only 24 hours, and fast delivery time using any carrier options. This double side 10cmx10cm can be fabricate at only 5USD for 5 to 10pcs by PCBWay. It's a standard PCB with silk screen and solder mask.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
10 PCBs for only 5USD
 

For different size of PCB we can instantly quote on PCBWay website using a zip PCB Gerber file without account.


A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
PCBWay Instant Quote
 

We can accurately see the preview of fabricated PCB generated by the company's online Gerber file viewer.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Top Side

 

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Bottom Side

 

 PCBWay also offer PCBA assembly service at reasonable price.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
PCBWay PCB Assembly Service


 Click here to download this PCB design

pcbway.com sponsor pcb project august 2025

PIC18F4550 and DSPIC30F2010 PCB fabrication from PCBWay.com


 
A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
A box of two PCB for PIC18F4550 and dsPIC30F2010 Prototype Board sponsored by PCBWay  

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer

A PCB package of 5-pcs


A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
A PCB package of 5-pcs

The PCB processing time is only one day with a few days of delivery time. DHL logistic is preferred by PCBWay and customers.

It's a standard and high quality PCB. Finished PCB needs a surface treatment process to treat them from corrosion. So even we don't solder them instantly its quality is not defected by outside environment. 

For this 5USD PCB order, we can choose different colors of solder mask and silk screen legend as preferred. The standard thickness is 1.6mm that is robust enough for most of application. We can order up to 10 units for only 5USD.

PCB Assembling

PCBWay offers PCB assembling service for a wide range of order with a minimum order of 25 units at a reasonable price. 

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Soldering PCB Kit
It takes one day to assemble and test this PCBA. The circuit working is correct. Some drill holes have problems so I need to correct it later.



A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
PCBA Top Side

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
PCBA Bottom Side

I tested this PCBA with my PC program to to the PICKit2 device programmer. Everything works well.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Power Supply Testing

I test it with PICKit2 on host software. It's error free.
 

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
PICKit2 Software Test

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
PICKit2 Software

I putted a two-row machine-tool female pin header to optionally place a dsPIC30F1010-30I/SO I soldered on an SMD IC adapter board.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
A dsPIC30F2010-20I/SP and a dsPIC30F1010-30I/SP that could fit on this PCBA
 

I needed to remove dsPIC30F2010 from this PCBA first before placing the dsPIC30F1010 chip.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Testing the dsPIC30F1010 on this PCBA

 This chip could programmed with the earlier version of PICKIT programmer, PICKIT2.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
Testing the dsPIC30F1010-30I/SP with PICKIT2

 Click here to download this PCB design.

 

CCS PICC Sample Code

CCS PICC is very easy to use but we need to pay for license. For beginners with with this embedded C compiler using its project wizard is a good choice.

Using Project 24 Bit Wizard

We can use this wizard for dsPIC30F2010 since it's a 24-bit instruction device. 

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
LED Blinking Using Wizard - Device Settings

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
LED Blinking Using Wizard - Blinking Example


 It will generate source code for us.

  1. #include <main.h>


  2. void main()
  3. {



  4. //Example blinking LED program
  5. while(true)
  6. {
  7. output_low(LED);
  8. delay_ms(DELAY);
  9. output_high(LED);
  10. delay_ms(DELAY);
  11. }

  12. }

 Its main.h file is separated from main.c file.

 

  1. #include <30F2010.h>
  2. #device ICSP=1
  3. #use delay(clock=20000000)

  4. #FUSES NOWDT //No Watch Dog Timer
  5. #FUSES CKSFSM  
  6. //Clock Switching is enabled, fail Safe clock monitor is enabled


  7. #define LED PIN_D0
  8. #define DELAY 1000


In the #use delay directive I have the parameter crystal=20000000 to clock=20000000 to prevent error.

On Board LED Blinking

On this PCBA there are two LEDs connects to RD0 and RD1 respectively. So I wrote a simple PIC24 C program to toggle these two LEDs. 

  1. #include "board.h"


  2. void main()
  3. {

  4. //Example blinking LED program
  5. while(true)
  6. {
  7. output_low(LED0);
  8. output_high(LED1);
  9. delay_ms(DELAY);
  10. output_high(LED0);
  11. output_low(LED1);
  12. delay_ms(DELAY);
  13. }

  14. }


I also separate its board.h header file as lists below.

  1. #include <30F2010.h>
  2. #device ICSP=1
  3. #fuses HS,NODEBUG,NOWDT,PR,CKSFSM
  4. #use delay(crystal=20000000)

  5. #define LED0 PIN_D0
  6. #define LED1 PIN_D1

  7. #define DELAY 500


I use its on-board 20MHz crystal oscillator instead of a 10MHz oscillator because I can not use its PLL to get its maximum 20MHz frequency. So this crystal oscillator will directly drive the processor.

Tactile Switches and LEDs

There are two push button connect to RC13 and RC14 of dsPIC30F2010 PCBA respectively. I use software polling from these two switches to toggle two on-board LEDs of RD0 and RD1 respectively. 

  1. #include "board.h"


  2. void main()
  3. {

  4. set_pullup(TRUE,PIN_C13);
  5. set_pullup(TRUE,PIN_C14);


  6. while(TRUE)
  7. {
  8. //TODO: User Code
  9. if(input(SW0)==0){
  10. output_toggle(LED0);
  11. delay_ms(500);
  12. }
  13. if(input(SW1)==0){
  14. output_toggle(LED1);
  15. delay_ms(500);
  16. }
  17. }

  18. }


I also modify its main.h file adding two buttons definition.

  1. #include <30F2010.h>
  2. #device ICSP=1
  3. #fuses HS,NODEBUG,NOWDT,PR,CKSFSM
  4. #use delay(crystal=20000000)

  5. #define LED0 PIN_D0
  6. #define LED1 PIN_D1
  7. #define SW0 PIN_C13
  8. #define SW1 PIN_C14

  9. #define DELAY 500


I don't use ICD feature due to complexity, and I don't this hardware.

RS-232 To TTL UART Converter

I putted a DB9 COM Port connector on this board for device and host PC communication. However I don't use its standard MAX232 level converter. Instead I use transistor level converter. 

This is a sample program for on-board UART.

  1. #include "board.h"

  2. #use rs232(UART1, baud=9600, stream=UART_PORT1)

  3. void main()
  4. {
  5. long cnt=0;
  6. printf("HELLO WORLD!\n\r");
  7. printf("Saturady 13 September 2025\n\r");
  8. printf("dsPIC30F2010 DIY Prototype Board.\n\r");
  9. printf("UART To RS-232 Demo Program\n\r");
  10. while(TRUE)
  11. {
  12. //TODO: User Code
  13. printf("Time In Seconds: %Lu \n\r",cnt);
  14. output_toggle(LED0);
  15. cnt++;
  16. delay_ms(1000);
  17. }

  18. }

 The board.h file is the same as above.

  1. #include <30F2010.h>
  2. #device ICSP=1
  3. #fuses HS,NODEBUG,NOWDT,PR,CKSFSM
  4. #use delay(crystal=20000000)

  5. #define LED0 PIN_D0
  6. #define LED1 PIN_D1
  7. #define SW0 PIN_C13
  8. #define SW1 PIN_C14

  9. #define DELAY 500

It will print the following text. LED connects to RD0 toggle every time the UART send data.

 

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
CCS PICC Serial Input Output Monitor

Analog to Digital Converter

There are one potentiometer and LM35 temperature sensor on this PCBA. The following C example use the 10-bit ADC module of dsPIC30F2010 to read the ADC value from these two on-board devices.

 


 


 

   

 

 


 

 

 

 

Wednesday, June 9, 2021

PortE programming of dsPIC30F1010 in XC16

PortE of dsPIC30F1010 is a 16-bit bi-directional I/O port. Within the 28-pin SOC package of this device, there are only six usable pins. They are not complex because there are not analog input function relate to this port.

PortE programming of dsPIC30F1010 in XC16

Experiment on breadboard

As it was shown in previous post, total pin numbers and its description is figured out below.

PortE programming of dsPIC30F1010 in XC16

Pin diagram of dsPIC30F1010

In SFR of this controller, PORTE is an input register while LATE is an output register. To get digital input data PORTE register must be read. Writing digital data out, LATE must be modify. TRISE is data direction control register. Writing '1' to this register to make data register as digital input. Clearing this register to make data register as digital output.

PortE programming of dsPIC30F1010 in XC16

dsPIC30F1010/2020 PORT REGISTER MAP

In this programming example I select RE4 as digital input, connecting to a button. RE5 connects an LED as a digital output.

PortE programming of dsPIC30F1010 in XC16

Schematic diagram

This system operates at 5VDC as it's supplied from PICKIT2 device programmer. Internal fast RC oscillator is used in this programming example to cut down component counts during prototyping on breadboard.

Pin 1 connects to reset circuit. Pressing SW1 to restart the system. Whenever SW2 is pressed and released, output LED D1 toggles its logic state.

Device's configuration setting is stored in "config.h" file of project directory.

Click here to download this example in zip file.


Friday, May 28, 2021

Beginning dsPIC30F1010 coding using XC16

Microchip dsPIC30F1010 is a 16-bit micro-controller, targeting for Switch Mode Power Supply (SMPS) Digital Signal Controller (DSC). It comes with many features that I don't show them all here. It has DSP (Digital Signal Processor) engine. It's 10-bit ADC module is able to convert analog signal up to 2Msps. Central Processing Unit (CPU) executes up to 30MIPS.

Start dsPIC30F1010 coding using XC8

dsPIC30F1010 reference image

It has DIP and SMD packages options. DIP package is friendly for breadboard prototyping. I choose a 28-pin SMD package.

Start dsPIC30F1010 coding using XC16

Pin diagrams of dsPIC30F1010

XC16 compiler is a C compiler developed by Microchip Technology. It has a free version that allow the programmer to code without code size limitation. Another C compiler for this 16-bit device is MikroC for dsPIC. However MikroC has code size limitation of 2kB of program space. MikroC has many library functions including peripheral libraries and external device interface libraries. Here I select XC16 v1.32 and MPLABX IDE v1.51. 

To get started I select pin RE5 of Port E to toggle at the rate of 500mS. The device will operate using its internal fast RC oscillator (FRC) with the nominal frequency of 15MHz at +5V DC supply voltage. Main C program shows below.

/*
 * Blinking dsPIC30F1010 using XC16 
 * in MPLABX IDE
 */
#include <p30F1010.h>
#include "config.h"

/*Nominal internal fast oscillator frequency of 15MHz*/
#define FCY 15000000UL
#include <libpic30.h>

void main(void){
    /*Additionaly select the maximum nominal frequency of 15MHz*/
    OSCTUNbits.TUN=0x07;
    /*Clear I/O of PORTE*/
    PORTE=0x0000;
    LATE=0x00000;
    /*PORTE direction as output*/
    TRISE=0x0000;
    while(1){
        /*Toggling RE5*/
        LATEbits.LATE5^=1;
        /*Wait for 0.5 second*/
        __delay_ms(500);
    }
}

It need configuration setting that store in another C header file "config.h" within project directory.

// DSPIC30F1010 Configuration Bit Settings

#include <p30Fxxxx.h>

// FBS
#pragma config BWRP = BWRP_OFF          // Boot Segment Write Protect (Boot Segment may be written)
#pragma config BSS = NO_BOOT_CODE       // Boot Segment Program Flash Code Protection (No Boot Segment)

// FGS
#pragma config GWRP = GWRP_OFF          // General Code Segment Write Protect (General Segment may be written)
#pragma config GSS = GSS_OFF            // General Segment Code Protection (Disabled)

// FOSCSEL
#pragma config FNOSC = FRC              // Oscillator Mode (Internal Fast RC (FRC))

// FOSC
#pragma config POSCMD = PRIOSC_OFF      // Primary Oscillator Source (Primary Oscillator Disabled)
#pragma config OSCIOFNC = OSC2_IO       // OSCI/OSCO Pin Function (OSCO pin has digital I/O function)
#pragma config FRANGE = FRC_HI_RANGE    // Frequency Range Select (High Range)
#pragma config FCKSM = CSW_FSCM_OFF     // Clock Switching and Monitor (Sw Disabled, Mon Disabled)

// FWDT
#pragma config WDTPS = WDTPOST_PS32768  // Watchdog Timer Postscaler (1:32,768)
#pragma config FWPSA0 = WDTPRE_PR128    // WDT Prescaler (1:128)
#pragma config WWDTEN = WINDIS_OFF      // Watchdog Timer Window (Non-Window mode)
#pragma config FWDTEN = FWDTEN_OFF      // Watchdog Timer Enable (Disable)

// FPOR
#pragma config FPWRT = PWRT_128         // POR Timer Value (128ms)

// FICD
#pragma config ICS = ICS_PGD            // Comm Channel Select (Use PGC/EMUC and PGD/EMUD)

// FUID0

// FUID1

Its schematic diagram is shown below.

Start dsPIC30F1010 coding using XC16
Schematic Diagram

Click here to download its zip file.

Start dsPIC30F1010 coding using XC16

XC16 in MPLABX IDE

Start dsPIC30F1010 coding using XC16

Circuit wiring on breadboard

I bought an SMD version of dsPIC30F1010. It was solder on SMD to DIP adapter that will be pinned on breadboard. As we have seen on the figure above, dsPIC30F1010 is placed on breadboard. ICSP adapter of PICKIT 2 connects to this microcontroller for in system programming and powering via USB bus. The controller operates at +5V from USB bus. It does not require an external crystal oscillator, as its internal fast RC oscillator is used.

 


320x50

Search This Blog

Labels

25AA010A (1) 8051 (7) 93AA46B (1) ADC (30) Analog Comparator (1) Arduino (15) ARM (6) AT89C52 (7) ATMega32 (57) AVR (58) CCS PICC (28) DAC (1) DHT11 (2) Display (106) Distance Sensor (3) DS18B20 (3) dsPIC (3) dsPIC30F1010 (3) dsPIC30F2010 (1) EEPROM (5) Environment Sensor (4) esp8266 (1) I2C (29) Input/Output (68) Interrupt (19) Keil (5) Keypad (10) LCD (48) Master/Slave (1) MAX7221 (1) MCP23017 (5) MCP23S17 (4) Meter (3) MikroC (2) Motor (15) MPLABX (73) Nokia 5110 LCD (3) OLED (2) One-Wire (6) Oscillator (8) PCB (10) PCD8544 (3) PCF8574 (5) PIC (108) PIC12F (3) PIC16F628A (3) PIC16F630 (2) PIC16F716 (4) PIC16F818 (11) PIC16F818/819 (3) PIC16F84A (16) PIC16F876A (2) PIC16F877A (9) PIC16F88 (2) PIC16F887 (60) PIC18 (19) PIC18F1220 (5) PIC18F2550 (5) PIC18F4550 (12) PICKit2 (1) PWM (11) RTC (9) Sensor (11) SH1106 (1) Shift Register (11) Shift Registers (3) SPI (24) STM32 (6) STM32 Blue Pill (6) STM32CubeIDE (6) STM32F103C8T6 (6) SysTick (3) temperature sensor (11) Thermometer (21) Timer/Counter (31) TM1637 (2) UART (7) Ultrasonic (4) Voltmeter (7) WDT (1) XC16 (2) XC8 (96)

tyro-728x90