Difference between revisions of "ME333 Sample Code"

From Mech
Jump to navigationJump to search
(New page: LCD.h)
 
Line 1: Line 1:
'''Simple PIC'''
[[Media:LCD.h|LCD.h]]

* [[Media:simplePIC.c|simplePIC.c]]: Flashes lights unless the USER button is pressed.

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

* [[Media:NU32.c|NU32.c]]: NU32 board library.
* [[Media:NU32.h|NU32.h]]: NU32 header file.
* [[Media:procdefs.ld|procdefs.ld]]: Linker file for NU32.
* [[Media:NU32_serial_comm.c|NU32_serial_comm.c]]: Serial communication test with the terminal.

'''Analog to digital'''

* [[Media:ADC_Read2.c|ADC_Read2.c]]: Reads two analog inputs repetitively and prints the results to the user's terminal.
* [[Media:ADC_Read2_LCD.c|ADC_Read2_LCD.c]] Reads two analog inputs repetitively and prints the results to the LCD.

'''Digital I/O'''

* [[Media:|Media:]]:
* [[Media:DIGIO_sfrs.c|DIGIO_sfrs.c]]: Digital I/O and change notification using SFR manipulation.
* [[Media:DIGI0_plib.c|DIGIO_plib.c]]: Digital I/O and change notification using the peripheral library.

'''Interrupts'''

* [[Media:INT_core_timer.c|INT_core_timer.c]]: Interrupt on core timer period match.
* [[Media:INT_ext_int.c|INT_ext_int.c]]: Interrupt on external interrupt line INT0.

'''LCD code'''

* [[Media:LCD.c|LCD.c]]: LCD library.
* [[Media:LCD.h|LCD.h]]: LCD header file.
* [[Media:LCDtest.c|LCDtest.c]]: Test program for LCD library.

'''Output compare (PWM)'''

* [[Media:OC_PWM_nolib.c|OC_PWM_nolib.c]]: Set up PWM by setting SFRs.
* [[Media:OC_PWM_lib.c|OC_PWM_lib.c]]: Set up PWM using peripheral library functions.
* [[Media:OC_square_wave.c|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'''

* [[Media:TMR_16bit.c|TMR_16bit.c]]: Set up a 16-bit timer to count the PBCLK.
* [[Media:TMR_16bit_external_clocks.c|TMR_16bit_external_clocks.c]]: Count two external clock sources, such as the A and B channel from a motor encoder.

Revision as of 20:52, 8 February 2012

Simple PIC

  • simplePIC.c: Flashes lights 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

  • [[Media:|Media:]]:
  • 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