Difference between revisions of "ME333 Sample Code"

From Mech
Jump to navigationJump to search
Line 46: Line 46:
* [[Media:DSP_sample_square_wave.zip|DSP_sample_square_wave.zip]]: Examples of FIR and FFT in both MATLAB and on the PIC32.
* [[Media:DSP_sample_square_wave.zip|DSP_sample_square_wave.zip]]: Examples of FIR and FFT in both MATLAB and on the PIC32.
* [[Media:DSP_mips32_fft.zip|DSP_mips32_fft.zip]]: Example of using the Q31 mips library for FFT. Contains a C source file and a header file.
* [[Media:DSP_mips32_fft.zip|DSP_mips32_fft.zip]]: Example of using the Q31 mips library for FFT. Contains a C source file and a header file.

'''Reading a quadrature encoder with the dsPIC33FJ12MC201 breakout board'''
* [[Media:NU32_dsPIC_QEU_example.c | NU32_dsPIC_QEU_example.c]]: Read the encoder count at 250Hz, send to the computer at 5Hz

Revision as of 11:31, 1 March 2012

Simple PIC

  • simplePIC.c: Flashes LEDs on the NU32 unless the USER button is pressed.

NU32 library, header file, procdefs, and terminal comm test

Analog to digital

  • ADC_Read2.c: Reads two analog inputs repetitively and prints the results to the user's terminal.
  • ADC_Read2_LCD.c Reads two analog inputs repetitively and prints the results to the LCD.

Digital I/O

  • DIGIO_sfrs.c: Digital I/O and change notification using SFR manipulation.
  • DIGIO_plib.c: Digital I/O and change notification using the peripheral library.

Interrupts

LCD code

Output compare (PWM)

  • OC_PWM_nolib.c: Set up PWM by setting SFRs.
  • OC_PWM_lib.c: Set up PWM using peripheral library functions.
  • OC_square_wave.c: Alternate between two different PWM duty cycles at 1 Hz. PWM is at 100 kHz and can be low-pass filtered to get a square wave analog output.

Counter/timer

DSP and FFT

Reading a quadrature encoder with the dsPIC33FJ12MC201 breakout board