Tag archives for XC8

Introduction to Microchip XC8 Compiler

This is a Getting Started with MPLAB X IDE and XC8 compiler tutorial. MPLAB® X IDE is the new Microchip IDE and it runs on a PC with Windows®, Mac OS® or Linux® to develop applications for PIC microcontrollers and replaces all MPLAB® C and HI-TECH compilers. XC8 is the new C compiler for PIC10, PIC12, PIC14, PIC16 and PIC18 microcontrollers. Learn how to start a new project with MPLAB X IDE, configure your PIC fuses and oscillator, write a simple Blink LED code and simulate the code with Proteus.

Connecting Light Emitting Diodes (LED) to a PIC Microcontroller – XC8

An LED is a semiconductor light source, when forward biased, it emits light. LEDs are used mainly to indicate the status of electronic circuits, for example to indicate that power is on or off but nowadays they are used in many applications including lighting and beam detection. In this article we will learn how to connect and switch on and off various LEDs to a microcontroller using XC8 Compiler. This is the simplest project a beginner in embedded programming can start with before attempting any complex projects as we have learned from the Introduction to XC8 Compiler article.

Reading Switches With PIC Microcontroller – XC8

Switches are digital inputs and are widely used in electroninc projects as most systems need to respond to user commands or sensors. Reading a switch is very useful because a switch is widely used and can also represent a wide range of digital devices in real world like limit sensors, level switches, proximity switches, keypads (a combination of switches) etc. Connecting a switch to a microcontroller is straight forward, all we need is a pull-up or pull-down resistor.

Interfacing LCD Display With PIC Microcontroller – XC8

LCDs are alphanumeric (or graphical) displays, which are frequently used in microcontroller based applications which require some information to be displayed to the user. There are many devices in the market which come in different shapes and sizes. Some LCDs have 40 or more character lengths with the capability to display several lines. Some other LCD displays can be programmed to display graphic images. Some modules offer color displays, while some others incorporate back lighting so that they can be viewed in dimly lit conditions. In this tutorial we will learn how to connect an LCD to any PORT of a microcontroller, display characters and send commands to LCD using lcd library with MPLAB Code Configurator and PIC18F Peripheral Libraries.

Analog to Digital Converter in PIC Microcontroller – XC8

Analog to Digital converters allow analog continuous voltages to be converted into a discreet digital numbers inside the PIC as the PIC can only process digital numbers. This can enable a PIC to be connected to analog sensors such as temperature sensors, pressure sensors, humidity sensors, optical sensors, and power sensors. Any sensor which can generate a voltage between 0V and a maximum 5V can be used. If the output voltage is higher than 5V, a method to step it down should be used such as a voltage divider with resistors.

Digital Thermometer using PIC Microcontroller and LM35 Temperature Sensor – XC8

Temperature sensors are very important in many projects especially in temperature logging devices and alarms. In this article we are going to design a digital thermometer using MPLAB XC8 compiler. This digital thermometer is built around the LM35 which is a precision integrated-circuit temperature sensor whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. Its output changes by 10 mV per °C so there is no need for calibration. It can measure a wide range of temperature from −55 to +150°C

PIC Microcontroller Communication with RS232 Bus – XC8

RS232 serial communication is one of the oldest communication where data is sent or received one bit at a time. This protocol can easily be used to communicate between a PC and various devices supporting this type of protocol like PIC microcontrollers, GPS, GSM modem etc. While other interfaces like Ethernet, FireWire, and USB all send data as a serial stream, the term "serial port" usually identifies hardware more or less compliant to the RS-232 standard, intended to interface with a modem or with a similar communication device. The Universal Asynchronous Receiver/Transmitter (UART) controller is the key component of the serial communications between a device and a PC or between devices. UART is also a common integrated feature in most microcontrollers today which is useful for communicating serial data (text, numbers, etc.) to your PC. In this article we're going to learn how to use the RS232 communication with MPLAB XC8 Compiler using the PIC18F Peripheral Library and MPLAB Code Configurator.

PIC Microcontroller Communication with SPI Bus – XC8

The SPI or Serial Peripheral Interface is a synchronous serial communication and allows multiple devices to communicate with a micocontroller(s). There are many devices that support the SPI protocol and can easily communicate with a microcontroller via SPI: A/D converters, D/A converters, SD Cards, DS1306 Real Time Clocks, MAX7219 serial display drivers, 25LC256 Serial EEPROM, etc. The devices don't have to be identical as long as they support SPI protocol. In this article we are going to configure the SPI Peripheral with MPLAB Code Configurator and PIC18F Peripheral Library.

Digital Barometer using PIC Microcontroller and MPX4115A Pressure Sensor – XC8

The MPX4115A is an atmospheric pressure sensor powered by 5V and delivers and output from ~0.25V to ~4.75V based on the pressure detected at room temperature (25°C). The device provides a linear output based on pressure. It can measure pressures between 15kPa and 115kPa. Note that 1 atmosphere of pressure at sea level is equal to 101,325 Pa or 101 kPa. This sensor is ideal for microcontroller based barometer, altimeter, data logger or weather station applications. In this article, we're gonna create a simple Digital Barometer using MPLAB XC8 compiler.