Difference between revisions of "PIC SDK"

From ElectroDragon
Jump to navigation Jump to search
(Registers)
 
Line 81: Line 81:
 
|-
 
|-
 
| ANSEL || ANALOG / DIGITAL SELECT REGISTER || -
 
| ANSEL || ANALOG / DIGITAL SELECT REGISTER || -
 +
|-
 +
| OSCCON || Register of Oscillator || -
 
|}
 
|}
 
 
  
 
== Demo code ==
 
== Demo code ==

Latest revision as of 06:14, 27 July 2020

Toolchain

Tools Type Header text
PICKit3 HW Hardware Programmer
MPLAB X IPE SW Hex programmer IPE
MPLAB X IDE SW IDE
K150 ISP PROG(old) SW Hex programmer ISP (old)
USB PROG: HIDbootloader.exe (in CD disk) SW / PIC18 USB IAP Tool Hex programmer


Compiler

Header text Supports Free Versions
MPLAB C complier C18 PIC18 YES
HI-TECH Universal Toolsuite -> ANSI C compiler - -
XC8 - -
MP-ASM - -
MikroC Pro for PIC PIC12, PIC16, PIC18, dsPIC, PIC24, PIC32 yes (2Kb program memory limitation)
CCS Compiler - -
SDCC PIC16, PIC18 Full Free
IAR? PIC18, dsPIC30, dsPIC33, PIC24 30-day evaluation edition

Setup PICC + PIC16F72

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


Flash by MPLAB IPE


Registers

Name Function Example
TRISx sets the direction of pins
 /* Configure all the ports as Output */
   TRISA = 0x00;
   TRISB = 0x00;
   TRISC = 0x00;
   TRISD = 0x00; 
PORTx read/write the port pin values PORTA = 0xff; /* Turn ON all the leds connected to Ports */
ANSEL ANALOG / DIGITAL SELECT REGISTER -
OSCCON Register of Oscillator -

Demo code

New demo code PIC16F684. PIC16F1933, PIC16F1829, PIC16F877:

For PIC18F14K50 USB Demo


Other Demo Code


Old - not used

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

PIC programmer.jpg

Note

  • RA3 is input only


Reference

Official Resource

Application Reference

Reference


Datasheet