Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

dspic starter kit

Status
Not open for further replies.

ag

New Member
I decided to jump into microcontrollers at the deep end and get the dsPIC starter kit 1.1. I have only written basic code for the 16F series (blinking leds, that's about it), so I may have bitten off more than I can chew, learning curve wise. I have programmed FFT algorithms before, though.
Does anyone have the links to any C code for basic fir filters or compressor algorithms for the dsPIC33fj256? Also, any links to resources for interfacing to the WM8510 audio I/O codec?
 
I decided to jump into microcontrollers at the deep end and get the dsPIC starter kit 1.1. I have only written basic code for the 16F series (blinking leds, that's about it), so I may have bitten off more than I can chew, learning curve wise. I have programmed FFT algorithms before, though.
Other than the new DSC stuff (which you don't have to use right away, or at all) in the 16-bit PICs, they're still just a PIC. Once you get used to the 16-bit registers (lots of bits to set in each one) they're very similar to an 8-bit PIC to program.

One thing, though: They're definitely NOT assembly language friendly. My 30F4013 was what forced me to relearn C, after many years of doing almost 100% assembler. They're designed for C and the toolsuite is totally C oriented. Once I got back up to speed in C, I realized I didn't dislike it as much as I had remembered. It's great for getting things done quickly and the code is much more readable than assembly. Much more portable too. C programs written for one PIC can be moved to another PIC with very minor changes. Not so for most assembler programs.
 
There are piles of examples on MicroChip's site for the 33F series PIC:
**broken link removed**
You'll find a free FFT, FIR, IIR, etc code libary on the site also.
Here is a simple hello world code for a dsPIC33FJ64MC802. You'll have to modify the code a bit for the dsPIC33fj256; such as the config bits etc, but you can see how simple it is using the C30 compiler from MicroChip:

Code:
/* This is a "Hello world" example for the dsPIC33FJ64MC802. It will toggle all
*  IO pins on the chip at a rate which is visible from a LED connected to
*  one of the IO pins. It uses the internal RC oscillator so all that is 
*  needed is a 10K pullup resistor on MCLR (pin 1 on a 28 pin DIP chip) and
*  power connected to ALL Vdd, Vss, AVdd, and AVss pins. Connect a 10uF, low ESR,
*  capacitor between VddCore (pin 20 on a 28 pin DIP chip) and ground. Do NOT 
*  connect VddCore to 3.3V! Don't forget to put some 0.1uF bypass capacitors
*  across the power pins close to the PIC.
*/

#include <p33FJ64MC802.h>

_FOSC(OSCIOFNC_ON & FCKSM_CSDCMD & POSCMD_NONE);	//Oscillator Configuration
_FOSCSEL(FNOSC_FRC);								//Oscillator Selection
_FWDT(FWDTEN_OFF);									//Turn off WatchDog Timer
_FGS(GCP_OFF);										//Turn off code protect
_FPOR( FPWRT_PWR1 );								//Turn off power up timer




int main(void)
{
	
	unsigned long x;

	ADPCFG = 0xffff;	//make ADC pins all digital
	TRISA = 0;			//Make all PORTs all outputs
	TRISB = 0;

	while(1)
	{
		for( x=0; x<73800; x++){;} //Delay apx 200ms
		LATA = ~LATA;				//Toggle all bits on ALL ports
		LATB = ~LATB;
	} 
	return 0;
}
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top