Baseline PIC Assembler Tutorials
by Gooligum Electronics

This tutorial series introduces the baseline (12-bit) PIC architecture, peripherals, and assembly language.
These tutorials describe the PIC12F508/509. The same code can be used for PIC12F629/675, and the PIC16F505 can be converted to PIC16F628.

Click on the lesson title to read each tutorial (PDF).
Click HERE for kits by Gooligum Electronics

1: Lighting an LED
Introducing the PIC12F508/509
Updated 11/1/10
Lesson 1:  
Turn_on_LED.asm
2: Flashing an LED
Adding delay loops
Updated 11/1/10
Lesson 2:  
L2-Flash_LED.asm
3: Writing Modular Code
Subroutines, relocatable modules, memory banking and paging
Updated 11/1/10
Lesson 3:  
Flash_LED-mod.asm
Flash_LED-sub.asm
Flash_LED-vector.asm
 
4: Reading Switches
Internal pull-ups, reading and debouncing simple switches
Updated 11/1/10
Lesson 4:  
L4-PB_LED-direct.asm
L4-PB_LED-shadow.asm
L4-Toggle_LED-cnt_dec.asm
L4-Toggle_LED-count.asm
L4-Toggle_LED-delay.asm
L4-Toggle_LED-int_pu.asm
L4-Toggle_LED-no_db.asm
 
5: Timer0
Using Timer0 for event timing, delays, debouncing and as a counter
Updated 11/1/10
Lesson 5: 
L5-Flash_LED_XTAL.asm
L5-Flash_LED_XTAL_R.asm
L5-Flash+PB_LED.asm
L5-Reaction_timer.asm
L5-Timer_debounce.asm
6: Assembler Directives and Macros
MPASM expressions, macros and conditional assembly
Updated 11/1/10
Lesson 6: 
L6-Flash_LED.asm
L6-Flash_LED_20p.asm
L6-Flash_LED_XTAL.asm
L6-Macro_debounce.asm
L6-Macro_debounce-cond.asm
L6-Reaction_timer.asm
7: Sleep Mode, Watchdog and Clock Options
Using sleep mode, wakeup on change, the watchdog timer, and external oscillators
Updated 11/1/10
Lesson 7: 
L7-Flash_LED_ext4M.asm
L7-Flash_LED_ext32k.asm
L7-Flash_LED_extRC.asm
L7-Sleep_LED_off.asm
L7-Sleep_LED_on.asm
L7-Wakeup.asm
L7-Wakeup+LED.asm
L7-WDTdemo.asm
L7-WDTdemo+clrwdt.asm
L7-WDTdemo+LED.asm
L7-WDTsleep.asm
8: Driving 7-Segment LED Displays
Single and multiple 7-segment displays, multiplexing,
lookup tables and binary-coded decimal (BCD)
Using the PIC16F505
Updated 11/1/10
Lesson 8:
L8-Count_7seg_BCD.asm
L8-Count_7seg_x1.asm
L8-Count_7seg_x1-dt.asm
L8-Count_7seg_x3.asm
9: Analog Comparators
Comparators, hysteresis, fixed and programmable voltage references
Using the PIC16F506
Updated 11/1/10
Lesson 9:
L9-Comp1_LED.asm
L9-Comp1_LED-intref.asm
L9-Comp1_LED-intref_hyst.asm
L9-Comp1_LED-neg.asm
L9-Comp1_TMR.asm
L9-Comp1_Wakeup.asm
L9-Comp2_2input.asm
L9-Comp2_2LEDs.asm
10: Analog-to-Digital Conversion
Using the analog-to-digital converter (ADC) on the PIC16F506
Updated 28/1/10
Lesson 10:
L10-ADC_4LEDs.asm
L10-ADC_hex-out.asm
L10-ADC_Vdd-measure.asm
L10-ADC_avg.asm
L10-ADC_dec-out.asm

delay10.asm
11: Arrays and Long Integer Arithmetic
Indirect addressing, multi-byte addition and subtraction and 8-bit multiplication
Updated 4/6/08
delay10.asm
delay10.asm     stdmacros.inc      stdmacros-base.inc