PIC24、dsPIC30FおよびdsPIC33F向けのCコンパイラです。
※ ここで使用しているのは、MPLAB C Compiler for dsPIC v3.20 Standard-Eval Versionです。
(MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs)
Student Editionは無料で提供されていますが60日の使用制限があり、期間経過後は設定可能な最適化レベルがレベル1のみに制限されます。しかし実用上は問題とならないでしょう。
次のページからダウンロードします。
MPLAB C Compilers
ダウンロードしたファイルを実行します。


評価版であるための制限について解説されます。


すべてのユーザーから使用できるようにするか、確認を求められます。

インストールの種類を選択します。ここでは[Custom]を選択するものとします。



環境変数の変更について確認を求められます。

MPLAB IDEから使用できるようにするための、レジストリの変更について確認を求められます。




インストール後のディレクトリにあるサンプルのバッチファイルを実行して、コンパイラの動作を確認できます。
正常に実行されると、次のように出力されます。
C:\Program Files\Microchip\MPLAB C30\examples\MPLABC30_Getting_Started>run_hello.bat C:\Program Files\Microchip\MPLAB C30\examples\MPLABC30_Getting_Started>pic30-gcc -ansi -Os hello.c -o hello.cof -Wl,--heap=0 C:\Program Files\Microchip\MPLAB C30\examples\MPLABC30_Getting_Started>pic30-bin2hex hello.cof ********************************************************** *** The following simulation should take about 1 minute ** ********************************************************** C:\Program Files\Microchip\MPLAB C30\examples\MPLABC30_Getting_Started>sim30 hello.cmd This is the Microchip dsPIC30 simulator version [CLI v4.10.02.00] Copyright (c) 2009 Microchip Technology Inc. All rights reserved. Device: 'dspic30super' Instruction set version [ISA2 Rev A 2003/01/31] Program space:- [000000..03ffff] Program FLASH [7ff000..7fffff] Data FLASH [f80000..f8000d] Configuration Registers Data space:- [0000..ffff] X Data RAM [3000..ffff] Y Data RAM Simulated Peripherals:- HsAdc Uart1 Uart2 Timer1 Timer2 Timer3 Timer4 Timer5 IC1 IC2 IC3 IC4 IC5 IOPortA IOPortB IOPortC IOPortD IOPortE IOPortF IOPortG KeySequenceEnable dsPIC30> lp hello.hex dsPIC30> rp dsPIC30> io nul dsPIC30> e dsPIC30> q dsPIC30> Hello, world!
以下のようなメッセージが出力され、コンパイルに失敗することがあります。
This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
このような場合の原因の1つに、環境変数の設定があります。
詳細な理由は不明ですが、ユーザー環境変数に「TEMP」「TMP」が定義されていないと、コンパイルに失敗します。(これらの変数は既定で定義されています)

| 種類 | 型 | ビット幅 |
|---|---|---|
| 整数 | char | 8 |
| short | 16 | |
| int | 16 | |
| long | 32 | |
| long long | 64 | |
| 浮動小数点数 | float | 32 |
| double | 32 | |
| long double | 64 | |
| ポインタ | ポインタ | 16 |
ソースファイルの最後の行が、復帰改行文字で終了していない場合に表示されます。