新闻  |   论坛  |   博客  |   在线研讨会
工欲善其事必先利其器之一(MPLAB软件介绍、工作原理及使用)
HXW718059156 | 2011-01-16 20:39:23    阅读:57400   发布文章

工欲善其事必先利其器之一(MPLAB软件介绍、工作原理及使用)

MPLAB IDE软件对于正在使用或者即将使用Microchip MCU的朋友来说都是及其重要的,俗话说,:工欲善其事,必先利其器。MAPLAB IDE作为我们打开PIC单片机神秘世界的敲门工具,了解熟悉它的使用,工作原理应该是首当其冲的,或者说,学习它,认识它,了解它,是我们以后高效编程的基础。下面我就结合自己近段时间的学习情况,向大家介绍一下MPLAB软件介绍、工作原理及使用。

MPLAB IDE简介:  

MPLAB 集成开发环境(IDE)是综合的编辑器、项目管理器和设计平台,适用于使用Microchip PICmicro® 系列单片机进行嵌入式设计的应用开发。MPLAB IDE 是适用于PICmicro® 系列单片机和dsPICTM 数字信号控制器,基于Windows® 操作系统的集成开发环境。   

MPLAB IDE 提供以下功能:

• 使用内置编辑器创建和编辑源代码。   

• 汇编、编译和链接源代码。   

• 通过使用内置模拟器观察程序流程调试可执行逻辑;或者使用MPLAB ICE 2000和 MPLAB ICE 4000 仿真器或MPLAB ICD 2 在线调试器实时调试可执行逻辑。   

• 用模拟器或仿真器测量时间。   

• 在观察窗口中查看变量。   

• 使用 MPLAB ICD 2PICSTART® Plus 或 PRO MATE® II 器件编程器烧写固件。   

• 使用MPLAB IDE 丰富的在线帮助快速找出问题的答案。   

MPLAB IDE系统要求:

运行MPLAB IDE 所需的最低系统配置:   

• PC兼容的奔腾(PENTIUM®)级系统   

• 操作系统:Microsoft Windows 98 SE, Windows 2000 SP2, Windows NT® SP6,Windows ME Windows XP   

• 64 MB 内存(推荐128MB)   

• 45 MB 硬盘空间   

• Internet Explorer 5.0 或更高版本   

Microchip公司网址:http://www.microchip.com/

目前,最新的MPLAB版本为8.6.3,本人使用的是MPLAB8.6.0,其功能,界面完全一样,只是最新的版本修复了少量的bug而已~!最新版本MPLAB8.6.3的下载链接为:http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469&part=SW007002在网页的底部,如下图,点击要下载的软件保存即可,也可以点击相应标题右键用迅雷下载。

另外,在Microchip公司网址:http://www.microchip.com/上有丰富的对我们使用MPLAB IDE和进行程序设计有关的资料,包括外设API使用手册,各种通用库下载以及论坛技术支持和样品申请,开发板购买等。(尽管很多人都怕英语,但是我们不得不承认95%的问题都能在我们所使用的MCU官网上找到答案,所以,我建议大家跟我一起把英语学好~!呵呵)

~!现在我先来介绍一下MPLAB IDE软件安装之后的目录,这个对我们学习和理解MPLAB IDE的使用和工作原理都很有帮助。我的安装目录为C:\study\Microchip\,在此目录下,存在以下几个文件夹,分别介绍一下:

 
 

其中,第一一个文件夹到第三个文件夹是与汇编相关的,因为我们开发PIC32大多数情况使用C语言就够了,所以,这里和后面我都将不做汇编相关的介绍。

第四个和第五个文件夹是我们的重点:

MPLAB C32 Suite文件夹包含的是:

·MPLAB C32相关的工具——子文件夹bin

·C32软件工具链的使用手册以及Microchip公司提供的各种外设API函数库的使用手册——子文件夹doc

·Microchip公司提供的C代码,汇编以及MCU外设使用例程——子文件夹examples,这些例程对我们学习PIC32单片机的汇编和C语言编程以及MCU外设驱动程序设计至关重要。

文件夹结构:

汇编代码例程:

 
 

C32代码例程:

MUC外设驱动例程(这些例程是我们学习和入门PIC32单片机最好的资料):

Peripheral Library Examples

Peripheral/Topic

Example Name

Path

Description

Operation in IDLE mode

operate_in_idle_mode

operate_in_idle_mode

Configures Timer1 to operate in IDLE mode, places CPU in IDLE mode and uses Timer1 interrupt to exit the IDLE mode.

A/D Converter

adc10_basic

adc10/adc10_ basic

Converts 2 analog inputs

Bus Matrix

bmx_ basic

bmx/bmx_ basic

Partitions RAM in user and kernel mode

Analog Comparator

cmp_ basic

cmp/cmp_ basic

Configures comparator in simple mode

Comparator Voltage Reference

cvref_basic

cvref/cvref_ basic

Generates a triangle wave on CVref output pin

DMA Controller

led_txfer

dma/led_txfer

Blink LED on an Explorer16 board using the DMA and a pattern stored in Flash.

pmp_txfer

dma/pmp_txfer

Performs a transfer from RAM to the PMP port

crc_calculation

dma/crc_calculation

Calculates CRC of flash memory using DMA CRC method

m2m_copy

dma/m2m_copy

Copies data from one memory region to another memory region

uart_echo

dma/uart_echo

Uses DMA channel to receive and transmit UART data

spi_txfer

dma/spi_txfer

Uses DMA channel to receive and transmit SPI data

I2C

i2c_master

I2c/i2c_master

Interfaces to Microchip serial EEPROM 24LC256 as an I2C master

Input Capture

incap_capture_event

incap/incap_capture_event

Captures and time stamps an external event

Interrupts

int_multi_vector

int/int_multi_vector

Uses Multi-vector interrupt mode

int_single_vector

int/int_single_vector

Uses Single-vector interrupt mode

NVM Controller

nvm_simple

nvm/nvm_simple

Erases, writes, and verifies a block of flash program memory

Output Compare

ocmp_simple_pwm

ocmp/ocmp_simple_pwm

Generates a PWM waveform

Oscillator

osc_basic

osc/osc_basic

Changes SYSCLK and PBCLK divider values while CPU is running

Prefetch-Cache

pcache_init

pcache/pcache_init

Configures Prefetch-Cache for basic operation

 

pcache_stat

pcache/pcache_stat

Demonstrates the effect of Prefetch cache code execution

ParallelMasterPort

pmp_master_mode2

pmp/pmp_master_mode2

Writes a block of data to an external memory using master mode 2 & 16-bit configuration

Ports

ports_basic

ports/ports_basic

Exercises all features of PORT I/O pins

 

blinky_leds

ports/blinky_leds

Blinks LEDs on Explorer-16 board

Power Modes

power_basic

power/power_basic

Configures CPU to wakeup from SLEEP using Watchdog timer

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
欢迎大家关注我的微信公众号--汽车电子expert成长之路,阅读更多原创性精彩文章。如果你觉得我的文章对你的学习/工作有所帮助,也请你帮忙转发到你的朋友圈,让更多的人能够看到我的文章,大家一起学习,一起进步!
推荐文章
最近访客