Cannot find plib.h MPLAB X IDE


I had copied a project that was builder in older MPLAB X IDE 3.x which I was opening in freshly installed MPLAB X IDE 4.05 but it was complaining about not find plib.h library which was referenced in the code.

I did a couple of days of digging into and now found the problem using this microchip form post, which says

The installer “PIC32 Legacy Peripheral Libraries – Windows” from here
asks for the installation directory during installation, even if you have only one XC32 version installed.
In my case it proposes: C:\Program Files (x86)\Microchip\xc32\v1.40
which is “wrong”, because I only have v1.43 installed.

I.e. it proposed the wrong directory, and if you simply accept, it will use that wrong path.
As a consequence you cannot use the peripheral library (without changing project paths)

Install it again into your “current” compiler directory.
I could imagine its a bug, but they won’t fix it for the legacy PLIB.

which was exactly the problem. The problem was older version of MPLAB X IDE uses legacy drivers (plib) while they have been abandoned in the newer version. Verse legacy drivers are not shipped with the latest version of MPLAX X 4.05.

To sum up the problem for a newbie, to make older code work in the latest MPLAB X, you have to do the following.

  1. Install MPLAB X V4.05 (latest by today)
  2. Intall X32 C-Compiler (you have to download this sperate)
  3. Install “PIC32 Peripheral LIbrary” (You have to download it first)
  4. When you install PIC32 Peripheral Library, it will try to install itself in XC32/1.40 folder but you have to change that. This is the trick that you have to apply. Simply supply it the path to XC32 folder, which must already exist and continue with the installation.

That should solve your problem of “not finding plib.h” which is the peripheral library for legacy (older) MPLAB.

Posted in Uncategorized | Leave a comment

Send SMS via C# Code GSM Module

2018-01-03 16_55_12-Form1

The following is the code that you need to send SMS through C# code. Note, this code goes in to Send button click function handler.


private void btnSend_Click(object sender, EventArgs e)
SerialPort sp = new SerialPort();
sp.PortName = txtPort.Text;
sp.WriteLine(“AT” + Environment.NewLine);
sp.WriteLine(“AT+CMFG=1” + Environment.NewLine);
sp.WriteLine(“AT+CSCS=\”GSM\”” + Environment.NewLine);
sp.WriteLine(“AT+CMGS=\”” + txtPhone.Text + “\”” + Environment.NewLine);
sp.WriteLine(txtMessage.Text + Environment.NewLine);
sp.Write(new byte[] { 26 }, 0, 1);
var response = sp.ReadExisting();

if (response.Contains(“ERROR”))
MessageBox.Show(“SMS Failed”);
MessageBox.Show(“SMS Sent successfully”);
catch (Exception ex)


When I test this code, it does return successfully weather GSM Modem is connected or not so there is definitely something not right with it.

Posted in Uncategorized | Leave a comment

Simple Interrup Example MPLAB

The following code will run on MX320 32-bit microcontroller. Taken from “Programming 32-bit Micrcontroller in C”.

Note that certain lines were modified to make it work.

** Single Interrupt vector test

#include <p32xxxx.h>
#include <peripheral\int.h>
#include <plib.h>
#define _T2IE IEC0bits.T2IE
#define _T2IF IFS0bits.T2IF
#define _T2IP IPC2bits.T2IP
int count;
void __ISR( 0, ipl1) InterruptHandler( void)
_T2IF = 0;
} // interrupt handler
// 1. init timers
PR2 = 15;
T2CON = 0x8030;
// 2. init interrupts
_T2IP = 1;
_T2IE = 1;
// 3. main loop
while( 1);
} // main

Posted in Uncategorized | Leave a comment

Change device in MPLAB IDE

Go to configure menu and select device to change a difference device than already selected.

select or change device - MPLAB IDE v8.92

A dialogbox will appear that allows  you select/change your existing device.


Posted in Uncategorized | Leave a comment

XC32 not showing up in tool suite MPLAB 8.92

x32 not showing up

In Microchip MPLAB IDE 8.92, “Microchip PIC32 C-Compiler toolsuite” were not showing. If that is the case, you just have to click t he checkbox “Show all installed toolsuits”.

Here is t he complete list of compilers

2018-01-02 16_29_55-Project Wizard


This is what you see if you dont check the checkbox


x32 not showing up-1

There is a related topic on microship site where the suggestion is that you need to register the DLL but here you don\t have to do that.


The reason C32 compiler is now showing up could be because the right microcontroller is not selected (it does not support C32). There is a bug in MPLAB, if you select MX32 bit microcontroller in the first project, it selects the default 8-bit micrcontroller instead, hence 32 bit options are not showing by default.

Posted in Embedded C32, Microchip, MPLAB | Leave a comment

Keyword Domain

What are the benefits or shortcomming of a keyword domain, which is rich for a particular search?

Let taking example of find business in a particular city and lets make the domain name as the city name. I have done exactly that. I created a website where on can submit their local business which can be found easily by a visitor.

My experience so far, the results are great for business in peshawar BUT I have also expanded this site to other cities in Pakistan like Islamabad, Lahore, Kohat and the results there are not that great. One reason is that there is competition for those keywords and since my domain name does not match that city name, it does not appear earlier in the result. I dont’ know what is the exact story is but it seems like keyword domain may work great for one city in particular or if the keyword is pertaining to the site theme it will work great but apart from that, it may EVEN hurt you. Or may be not! I have to find that answer.

Here is a good link about keyword domain

Write below your own comments if you have any about the subject!

Posted in Uncategorized | Leave a comment

Craigslist like site for Peshawar is portal similar to craigslist. User can sell stuff andd post ads. It also works as city portal, where user can find local business and in a way similar to angiesllist . User can rate and review business.

The site is setup by Hammad Khan to help business show their online presence and where users can find them easily using simple google search.


Posted in Uncategorized | Leave a comment