熟悉开发环境是学习单片机的第一步,现在介绍下PIC得开发环境,PIC的开发环境有老的 MPLAB IDE, 和最新的MPLAB X IDE.
MPLAB X IDE 比老的MPLAB IDE, 编写代码的起来更方便,出错的概率也低因为MPLAB X IDE 时时的检测书写错误。
MPLAB X IDE 的安装:
第一步 安装JAVA 的运行环境(因为MPLAB X IDE是用JAVA程序写的)
安装jdk 6.1(在jdk 当中包含了运行环境jre,当然只安装jre也行)
双击jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe安装jdk 6.1
第二步 安装开发环境 MPLAB X IDE
mplabx-ide-v1.10-windows-installer.exe
第三步 安装C编译器
我们用的是PIC/10/12/16系列安装 picc-9_81-win.exe即可。
安装完成之后会在桌面上出现两个图标
MPLAB driver switcher 驱动选择 如果你的电脑上同时装有MPLAB IDE 8和MPLAB X IDE的时候,用来选择是那个软件使用调试烧写器如ICD PICkit。
MPLAB X IDE v1.10 开发环境
建立工程:
1 打开MPLAB X IDE ,File->New Project 弹出窗New Project窗口 在 Categories: 中选择 Microchip Embedded,然后在Projects:中选择Standalone Project.

2 点击 next ,然后在Device中选择单片机型号如:PIC16LF1823.

3点击next ,是否支持调试头不选

4点击next ,选择工具如;选择 ICD3

5点击next , 选择编译器如:选择HI-TECH PICC (V9.81)

6点击next, 在Project Name中输入工程名如:myproject ,点击Browse...选择工程文件存放的路径,然后点击Finish工程建立完毕。
补充: 如果想支持中文将Encoding 改为GB2312。

7 在Projects 窗口中可以看到我们建立的工程 .

8 右击Source Files ->New->C Main Flie.... 弹出了窗口 New C Main File ,点击Finish建立源文件.

9 我们就可在里面书写C程序代码了。

10 写完代码之后编译 可以点击 工具栏上的按钮

11 烧写点击工具栏上的
补充:
如用 ICD3 烧写可以可以选择内部供电要如何选择呢?
1,File->Project Properties 弹出窗口

2,在Categories 中点击选择ICD3,然后在Option categories 中的下拉列表中选择Power.

3, 勾上Power target circuit from ICD3 , 在Voltage Level 中选择电压(一般默认即可)。