Category:PIC

From ElectroDragon
Jump to: navigation, search


Schematic

Quick start guide

  • You will need PICKIT3, and dvelopment board PIC16F72, install the pin headers for programming
  • Find MPLAB 8.x version in our github page, and use the code below, or download here of the workspace zip file - File:Led pic.zip
#include<htc.h>
 
// Config word ?? no need
//__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_ON & CP_OFF);
 
// Define LED pin
#define LED  RA0
 
// Define CPU Frequency
// This must be defined, if __delay_ms() or 
// __delay_us() functions are used in the code
#define _XTAL_FREQ   8000000    
 
 
// Main function
void main()
{	
	TRISA0 = 0;				   // Make RA0 pin output
	LED    = 0;				   // Make RA0 low
 
	while(1)
	{
		__delay_ms(500);       // Half sec delay
		LED = 0;               // LED off
		__delay_ms(500);       // Half sec delay
		LED = 1;               // LED on
	}
}

Toolchain

  • PICkit3 hardware
  • K150 (old)
  • MPLAB IDE + HI-TECH universal toolsuite (compiler)
  • Pickit standalone programmer

Build Guide MPlab IDE

toolchain setup animation
  • Updated with animation tutorial
  • Install MPLAB, HI-TECH PICC9.83
  • select MCU -> pic16f72
  • programmer -> pickit3
  • project wizard -> use compiler hi-tech universal toolsuite -> ANSIS
  • click to compile the default project, blink RA0 LED

build first demo and flash

Upload code
  • Must select proper configuration bit, check crystal, LP - low power, RC internal, XT external, HS high speed crystal, for 8M crystal should use this one, read more on datasheet
  • Demo use pickit standalone programmer, configuration bit set to 3FF2
  • Crystal - HS crystal
  • WDT - disable -> 0
  • Power-on timer - enable -> 0
  • BOR - enable -> 1
  • LP - code protection off -> 1

PIC ICs

Type Price cny Pins Flash RAM


PIC12F508 2 SO-8
PIC12F629 2.4 SO-8
PIC12F675 (629) 2.2 SO-8
PIC12F683 2 SO-8
PIC12F690 3.5 SSOP-20
PIC16F630 4.2 SO-14
PIC16F72 1 SO-28
PIC16F684 3.2 SO-14
PIC16F690 3.9 SSOP-20
PIC16F1455 5.7 TSSOP-14
PIC16F1513 4.5 SSOP-28
PIC16F1705 5.5 SO-14
PIC16F1718 6.5 SSOP-28
PIC16F1823 / 1824 3.4 SO-14
PIC16F1937 6 TQFP-44
PIC16F877 12 TQFP-44
PIC16F887 7.5 TQFP-44
PIC16F74 4 TQFP-44
PIC18F45K22 8 TQFP-44
PIC18F46K22 8.7 TQFP-44
PIC18F2840 12.8 TQFP-44
PIC18F4520 12.5 TQFP-44
PIC16F1946 6.4 TQFP-64
  • PIC16F1824

Datasheet


Demo code


Old - not used

  • Build and program, follow the guide below
  • Use PICkit programmer

PIC programmer.jpg

This category currently contains no pages or media.