X10 Speech Recognition Interface

X-10 is an international technology that provides an easy method of creating home automation. Marry this technology with a speech recognition circuit and the user can use verbal commands to activated electrical appliances and lights around the home or apartment. If this is of interest to you then read on.

The X-10 Interface circuit will allow you to control up to 16 appliance control modules on any of the sixteen available X-10 house codes using the SR-07 speech recognition circuit. The SR-07 speech recognition circuit has its own construction article here and that information will not be repeated here. You may purchase the speech recognition circuit in a kit form (SR-06), or a fully assembled and tested circuit (SR-07) from Images SI Inc., see parts list. The X-10 speech interface requires the speech recognition circuit to function. The speech recognition circuit is the front end of the system.

The speech recognition circuit and components are NOT rated for medical use, critical care or when the possibility of a non-functioning or non-recognized command may cause damage, personal injury or put anyone or thing in jeopardy.

X-10 Technology

X-10 technology has been in the United States since 1978, introduced into our country by Sears and Radio-Shack. It uses the home’s household wiring (power grid) that powers electrical appliances to transmit and receive control commands to the appliances. There are a variety of X-10 commands at our disposal that include; on, off, dim/bright, all on, all off, etc., see table below. Our X-10 speech interface will issue only the basic on and off commands.

It appears that Radio-Shack no longer is carrying X-10 hardware. No matter, X-10 has many distributors including Amazon.com and Images SI Inc. You can also purchase X10 hardware from the official X10 site at //www.x10.com/automation/index.html. There is a dizzying array of X10 components available. You require two X-10 components, the PL-513 Power Line interface, see figure 1 and at least one appliance controller AMC486 see figure 2. If you wish to run more than one appliance, you would need an equal number of appliances.

X-10 Command Codes

Code              Function Description
0 0 0 0 1        All Units Off Switch off all devices
0 0 0 1 1        All Lights On Switches on all lighting devices
0 0 1 0 1        On Switches on a device
0 0 1 1 1        Off Switches off a device
0 1 0 0 1        Dim Reduces the light intensity
0 1 0 1 1        Bright Increases the light intensity
0 1 1 1 1        Extended Code Extension code
1 0 0 0 1        Hail Request Requests a response from the device(s)
1 0 0 1 1        Hail Acknowledge Response to the previous command
1 0 1 x 1        Pre-Set Dim Selection of two predefined levels of light intensity
1 1 0 1 1        Status is On Response indicating that the device is on
1 1 1 0 1        Status is Off Response indicating that the device is off

Aside from the commands, listed above, the X-10 signal protocol also consists of an address.

Hardcore Micros – Microchips PIC10F32x

As an embedded engineer I’m always looking for more and more functions from a smaller and smaller package. Over the last six months, Microchip has been releasing information about the smallest of its chips – PIC10F32x – and in this post I want to look at the new and interesting features coming to PICs.

Up till now when I have looked at the very small end of the micro range, the PIC10s have never offered anything that would get me excited or convince me that they are very usable. At ebmpapst, when I’m designing bottom-end tiny products, I need at least one PWM, so I have been using what I would have called a slightly overspec PIC12F615 for my products.

In the last few weeks however, Microchip has released the Data Sheet for the PIC10F320 and PIC10F322. These I have been looking at using for some time; however, it was the added features of these two new chips that stand out to me, and I’m not just talking about the added Flash and RAM or PWMs they now have.

The first new shiny feature is Configurable Logic Cells (CLC). The PIC10 is not the first to have these, as there is a new breed of PIC12s and 16s that have these too. However, having this and the other features on such a small chip is to me surprising and also powerful.

CLCs are chunks of combinational logic that can be configured to perform high-speed functions without needing core processing time. Each block has 8 inputs that can come from I/O pins, internal clocks, Peripherals, or even from register bits. These inputs can then be passed through one of a number of pre-configured logic blocks that perform functions like AND-OR, S-R, J-K and D type flip-flops. What’s then quite nice is that an external pin can be driven directly from this output, read internally, or it can even generate an interrupt. It may not have the flexibility and programmability of, say, a FPGA LAB, but I can see these becoming very useful glue logic tools for embedded engineers.

Another nice feature to find in such a small chip is the Complementary Waveform Generator (CWG). This allows you generate controllable waveforms for use in a half bridge or switching power supply for example. The module allows for selectable input sources and have some nice and simple auto-shutdown controls. Dead time is also programmable for both the rise and fall side. I’ve seen similar modules on the larger chips but found this much easier to understand and more independent of the code that may be running on the core.

Both the CLC and CWG could be really nice units if only you have a clock source that is easy to control and whose frequency is easy to set. Well the chips now also come with a Numerically Controlled Oscillator (NCO) that can be used to feed the above CLC and CWG modules. This is no Phase Lock Loop (PLL) but will allow for simple clock division. The module works by having a configured value added to an accumulator on each clock cycle. The overflow is then used as a raw output that can be used to drive the module in a number of modes. For example, simple toggling of the output allows for a fixed 50 percent duty, or you can use the module for pulsed frequencies with output pulse width control.

The new features could very well be a clue to where Microchip is going with new designs, maybe trying out these features on the smaller silicon before it makes its way up to the 32bit cores. However, these new features are a welcome sight to me as an embedded engineer. I like the idea of getting more and more features inside small chips – my designs do not need a lot of I/O pins but they need to be clever. I really don’t want to be using a whopping big QFP just to get the features, but suffer with the high pin count.

Climate Controller Designed with PIC

The Sensirion SHT11 sensor is utilized by this climate controller in order to read the temperature and humidity measurements simultaneously.

The measurement and display scale of the climate controller can be selected between Centigrade and Fahrenheit as the temperature measurement ranges from -40° to 123°C and humidity is 0-100% temperature compensated. Some of the uses of this device include food dehydrating, hatchling warmer, small room temp/humidity control, and Greenhouse temperature/humidity control.

The three distinct CD outputs with 10A load or 2DC outputs with one AC up to 4A are managed by the controller board. It also reads the sensor, switches the outputs, reads the rotary encoder, and updates the LCD display. The controller board can be used as a standalone device if temperature and humidity readings only are required.

The sensor uses the combined humidity and temperature sensor SHT11 from Sensirion which comes in a SMDpackage. It is designed from a double sided PCB so that the more obtainable and handy 8-pin DIP carrier version is allowed to be used. A 14-bit analog to digital converter is contained in the sensor for temperature conversion which results in a maximum resolution of 0.1°C.

Data Encryption Routines for PIC24 and dsPIC Devices

Currently, there are three data encryption standards approved for use in the Federal Information Processing Standards (FIPS). This application note discusses the implementation of two of these for PIC24 and dsPIC30/33 devices: Triple Data Encryption Standard (TDES) and Advanced Encryption Standard (AES).

TDES Encryption
The original Data Encryption Standard (DES), a 64-bit block cipher, was invented in the early 1970s by IBM®. DES uses a 64-bit encryption key: 56 bits for encoding and decoding, the remainder for parity. It was adopted by the United States government in 1977 as standard for encrypting sensitive data. By the mid 1990s, several public organizations had demonstrated that they were able to crack a DES code within days.

Triple DES (TDES) is a variant of DES, and is described in FIPS 46-2 and 46-3. TDES uses three cycles of DES to extend the key from 56 bits to 112 or 168 bits, depending on the mode of operation. Because of known weaknesses in the DES algorithm, the actual security is believed to be on the order of 80 and 112 bits, respectively, for the two different methods. The use of TDESwas suggested by the American government in 1999 for use in all systems, except in legacy systems, where only DES was available.

There are several different modes of TDES. The most common involves using two different keys. The data is encrypted with the first key. That result is then decrypted with the second key. The data is then finally encrypted once again with the first key. Other modes of operation include using three different keys, one for each of the stages, and encrypting in all rounds instead of decrypting during the second round. For most new applications, TDES has been replaced with Advanced Encryption Standard (AES). AES provides a slightly higher security level than TDES and is much faster and smaller in implementation than TDES.

The original DES algorithm is outlined in Figure 1. The cycle is run 32 times before the ciphertext is valid.

PIC Controlled Relay Driver

This circuit is a relay driver that is based on a PIC16F84A microcontroller. The board includes four relays so this lets us to control four distinct electrical devices. The controlled device may be a heater, a lamp, a computer or a motor. To use this board in the industrial area, the supply part is designed more attentively. To minimize the effects of the ac line noises, a 1:1 line filter transformer is used.

1 x PIC16F84A Microcontroller
1 × 220V/12V 3.6VA (or 3.2VA) PCB Type Transformer (EI 38/13.6)
1 x Line Filter (2×10mH 1:1 Transformer)
4 × 12V Relay (SPDT Type)
4 x BC141 NPN Transistor
5 × 2 Terminal PCB Terminal Block
4 × 1N4007 Diode
1 × 250V Varistor (20mm Diameter)
1 x PCB Fuse Holder
1 × 400mA Fuse
2 × 100nF/630V Unpolarized Capacitor
1 × 220uF/25V Electrolytic Capacitor
1 × 47uF/16V Electrolytic Capacitor
1 × 10uF/16V Electrolytic Capacitor
2 × 330nF/63V Unpolarized Capacitor
1 × 100nF/63V Unpolarized Capacitor
1 × 4MHz Crystal Oscillator
2 × 22pF Capacitor
1 × 18 Pin 2 Way IC Socket
4 × 820 Ohm 1/4W Resistor
1 × 1K 1/4W Resistor
1 × 4.7K 1/4W Resistor
1 × 7805 Voltage Regulator (TO220)
1 × 7812 Voltage Regulator (TO220)
1 × 1A Bridge Diode

The transformer is a 220V to 12V, 50Hz and 3.6VA PCB type transformer. The model seen in the photo is HRDiemen E3814056. Since it is encapsulated, the transformer is isolated from the external effects. A 250V 400mA glass fuse is used to protect the circuit from damage due to excessive current. A high power device which is connected to the same line may form unwanted high amplitude signals while turning on and off. To bypass this signal effects, a variable resistor (varistor) which has a 20mm diameter is paralelly connected to the input.

Controller schematic

Another protective component on the AC line is the line filter. It minimizes the noise of the line too. The connection type determines the common or differential mode filtering. The last components in the filtering part are the unpolarized 100nF 630V capacitors. When the frequency increases, the capacitive reactance (Xc) of the capacitor decreases so it has a important role in reducing the high frequency noise effects. To increase the performance, one is connected to the input and the other one is connected to the output of the filtering part.

Supply schematic

After the filtering part, a 1A bridge diode is connected to make a full wave rectification. A 2200 uF capacitor then stabilizes the rectified signal. The PIC controller schematic is given in the project file. It contains PIC16F84A microcontroller, NPN transistors, and SPDT type relays. When a relay is energised, it draws about 40mA. As it is seen on the schematic, the relays are connected to the RB0-RB3 pins of the PIC via BC141 transistors. When the transistor gets cut off, a reverse EMF may occur and the transistor may be defected.

To overcome this unwanted situation, 1N4007 diodes are connected between the supply and the transistor collectors. There are a few number of resistors in the circuit. They are all radially mounted. Example C and HEXcode files are included in the project file. It energizes the next relay after every five seconds.

Sinusoidal Control of PMSM Motors with dsPIC30F / dsPIC33F DSC

Motor Control Pulse Width Modulation (MCPWM) and high-speed A/D Converter. The DSP engine of the dsPIC30F2010 supports the necessary fast mathematical operations. The dsPIC30F2010 family member is a 28-pin 16-bit DSC specifically designed for low-cost/high efficiency motor control applications. The dsPIC30F2010 provides these key features: · 30 MIPS processing performance · Six independent or three complementary pairs of dedicated Motor Control PWM outputs · Six-input, 1 Msps ADC with simultaneous sampling capability from up to four inputs · Multiple serial communications: UART, I2CTM and SPI · Small package (6 mm x 6 mm QFN) for embedded control applications · DSP engine for fast response in control loops
This application note describes a method of driving a sensored Permanent Magnet Synchronous Motor (PMSM) with sinusoidal currents controlled by a dsPIC30F Digital Signal Controller (DSC). The motor control firmware uses the dsPIC30F peripherals while the mathematical computations are performed by the DSP engine. The firmware is written in `C’ language, with some subroutines in assembly to take advantage of the special DSP operations of the dsPIC30F.
· Sinusoidal current generation for controlling PMSM motor phases using Space Vector Modulation (SVM) · Synchronization of sinusoidal voltages to PMSM motor position · Four-quadrant operation allowing forward, reverse and braking operation · Closed-loop speed regulation using digital Proportional Integral Derivative (PID) control · Phase advance operation for increased speed range · Fractional math operations performed by the DSP engine of the dsPIC® DSC
You will need the following hardware to implement the described motor control application: · PICDEMTM MCLV Development Board (Figure 1) · Hurst DMB0224C10002 BLDC Motor · 24 VDC Power Supply You can purchase these items from Microchip as a complete kit or as individual components. Check the Development Tools section of the Microchip web site for ordering information.
The dsPIC30F Motor Control family is specifically designed to control the most popular types of motors, including AC Induction Motors (ACIM), Brushed DC Motors (BDC), Brushless DC Motors (BLDC) and Permanent Magnet Synchronous Motors (PMSM), to list a few. Several application notes have been published for ACIM operation (AN984, AN908 and GS004) and Brushless DC Motor Control operation (AN901, AN957 and AN992) based on the dsPIC30F motor control family. These application notes are available on the the Microchip web site (www.microchip.com). This application note demonstrates how the dsPIC30F2010 is used to control a sensored PMSM motor with sinusoidal voltages. The design takes advantage of dsPIC30F peripherals specifically suited
© 2005 Microchip Technology Inc.
It is strongly recommended that you read the “PICDEMTM MCLV Development Board User’s Guide” (DS51554) to fully understand the hardware topology being used in this application note. This User’s Guide can be downloaded from the Microchip web site. Figure 2 is a simplified system block diagram for a Sinusoidal PMSM motor control application. This diagram will help you develop your own hardware. On the low side, the voltage limit is 10V. On the high side, the voltage limit is 48V. It is important to note that the heat sink on the IGBTs have very limited heat dissipation, so high power requirements may not be easily met with the PICDEMTM MCLV development board. To use the PICDEMTM MCLV development board for this application, use the jumper settings shown in Table 1 and the motor connections shown in Table 2 and Table 3.
Position for Sinusoidal Control (dsPIC® DSC Sensored) Open Open Open Short
Phase A 3-Phase Phase B Inverter Phase C 3-Phase PMSM Motor
Jumpers J7, J8, J11 J12, J13, J14
J15, J16, J17, J10 J19
AN2 Reference Speed S2 Start/Stop RB3/CN5 RB4/IC7 RB5/IC8 Hall A R21 Hall B R22 Hall C R25
Position for Sinusoidal Control (dsPIC® DSC Sensored) Phase A (White) Phase B (Black) Phase C (Red) Ground (Green) if available
Connector J9 M3 M2 M1 G
Salient aspects of this topology are: · Potentiometer R14 selects the desired speed (Reference Speed) · Rotor position is detected using Hall effect sensors connected to pins RB3, RB4 and RB5 · Current feedback is provided through a simple operational amplifier circuit · Fault input is received through a comparator circuit connected with the current feedback circuit. The current is sensed using a 0.1 ohm resistor (R26) You can easily adjust the values of the resistors to accommodate the current capabilities of the motor being used for your application. The motor drive circuit, on the other hand, is designed to drive a 24V PMSM motor. You can change the hardware to meet the drive requirement of a specific motor. Note: Refer to the “PICDEMTM MCLV Development Board User’s Guide” (DS51554) for details on how to change the hardware for use with motors greater or less than 24V.
Position for Sinusoidal Control (dsPIC® DSC Sensored) Red Black White Brown Green
Connector J9 +5V GND HA HB HC *
The colors referenced in Tables 2 and 3 for the motor windings and hall sensors, respectively, pertain to the Hurst 24V motor available from Microchip. The ground wire is sometimes not available on some motors.
After your code is developed and you have downloaded it to the dsPIC30F, you will need to press switch S2 to start and stop the motor. The potentiomer marked REF (R14) sets the required speed and direction of rotation of the motor. The motor does not need to stop to change direction of rotation.
© 2005 Microchip Technology Inc.

Introducing Microchip’s GC Family – An Intelligent Analog MCU

An increasing market demand for sophisticated products that interface the digital world of 1s and 0s with the “real-world” has catapulted the need for analog solutions. Consumer devices, from cells phones and music players to blood pressure and glucose meters, are all part analog, and companies like Microchip Technology are more than suited for ensuring their agile development and deployment.

The announcement of Microchip’s latest family of analog microcontrollers—the GC family—expands upon their portfolio of analog intensive applications. It joins the sophisticated PIC line, tailored for advanced applications like motor control, digital power, and automotive lighting, and the PIC24F line, suited for cost-sensitive applications such as low-cost motor control and LED lighting. By embedding Intelligent Analog, Microchip’s GC family of microcontrollers offers designers reduced development costs, consistent analog performances from one design to the next, and faster market delivery. As Jason Tollefson, Senior Marketing Manager at Microchip, told EEWeb, “The GC [family] is the latest and most sophisticated that we’ve done.”

What sets the GC family apart?
The PIC24F “GC” family integrates several new design enhancements, including a 16-bit Delta Sigma microcontroller and a 10 megasample-per-second (MSPS) analog-to-digital (A/D). “It’s the first time we’ve done both of these microcontrollers on one product,” Jason told us. And, for Microchip’s advanced analog integration, these enhancements on one product, “Is a really high watermark.”

In addition to dual microcontrollers, the GC family also incorporates an “analog signal chain” that encompasses dual mega-sample digital-to-analog converters, dual op-amps, and three comparators, all of which interact with high precision analog-to-digital converters. “All of that is interconnectable within the chip, so that you can create analog circuits within the chip and then present only the pieces to the outside world that are required. that helps us with the noise__ we’re not bringing signals out to the board level, and bringing them back in with the possibility of coupling noise from some external component,” explained Jason.

With the GC family, Microchip has done the work ahead of time. As Jason told EEWeb, “By bringing those components on board, the Microchip design team has now contended with noise and interference with digital blocks and we’ve also contended with communication paths and taking out roadblocks. By bringing those components on, the designer has a chip that has those components embedded and they get consistent analog performances from one design to the next. As they design new applications, they don’t have to worry about if they’re designing this analog on this particular board correctly—that’s all embedded in the microcontroller—they just have to worry about interfacing with their sensors.” The integration of multiple blocks inside one chip allows them to be controlled by software that the designer develops, thereby reducing design costs and ensuring faster time-to-market.

Flexible Features for Designers
The GC family offers several features to ensure designers needed flexibility and end-product quality. These include a programmable block referred to as the Programmable Gain Amplifier (PGA), an interconnected switch, and a Peripheral Pin Select.

The PGA which serves as the input to the 16-bit Sigma Delta, provides developers four levels of programmable gain, up to 16x the original size. This, in turn can be combined with the op-amps to create differential input and gain stage. The interconnected switch enables developers to tie into multiple components and programmatically configure signal paths to different devices. Because each component is under software control, developers can make refinements “on the fly.” This enhancement is achieved by the inclusion of muxes into each of the different blocks. “The idea,” explained Jason, “Is that outputs at certain blocks feed into the inputs of other blocks and vice versa. So, it’s quite flexible in that the muxes have a huge amount of inputs.”

The Peripheral Pin Select serves as a re-mapping feature, allowing developers, using software control, to remap peripherals away from pins to other pins. As Jason articulated, “There’s a certain combination of analog and digital peripherals that a customer needs and [the developer] can manipulate where these digital peripherals come out to make use of them to sort of preserve the analog and also allow them to make the most use of their design.”

Features for Rich Applications
The GC Family is the second device in the PIC24 family to include a Direct Memory Access controller (DMA). The DMA serves to facilitate the transfer of data between the CPU and the peripherals without CPU assistance and in doing so, saves power. It also allows the device, “To do two things as once,” said Jason, “We can have our core doing a function and updating the LCD with new information, while in the background, our DMA can be streaming information from [the] 50 channels of A to D into a RAM space.”

Another noteworthy attribute of the GC Family is the ability tailor the presentation of rich information to the end user. If the designer chooses to implement a screen for example, they can show icons that can be animated, they can also show information in text form, or even simple graphic form. With the rich information display, explained Jason, “You can present specific procedures to a user rather than a blinking icon and a number. You can tell them how to apply the sample, when to apply the sample, and if they want to upload the data or results of the information to a smart phone or to a PC, it can walk them through that process as well. With an aging community of diabetic folks, that might be more important to be able to walk them through the process so that there’s not as much jeopardy of them doing the process incorrectly and the data not being valid.”

These features, coupled with USB and LCD touch sensing interfacing, along with Microchip’s XLPtechnology to ensure extended battery life, make the GC family an ideal choice for medical and industrial applications. As Jason indicated, “[Microchip] looked a lot at the medical space—that’s one of our key targets with the family—so things like blood pressure meters, glucose meters, and so on. We also looked at industrial applications, so things like lab instrumentation, environmental quality testers, data loggers, production tracks where they need high-speed sensors, and even things like mining where the miners wear portable gas sensors to make sure they’re not being exposed to dangerous chemicals.”

In order to service the spectrum of designers that will be developing these applications, Microchip included high-speed 12-bit and 16-bit A/D converters. Whereas, in the past developers were limited to using only one A/D converter, providing both expands the capabilities of the end application. The high-speed 12-bit A/D converter, for example could be used to quickly analyze an area of interest, after which time, the 16-bit A/D convertor could be used to collect very fine detail on a subset of data.

Development Kit
To help designers get started, Microchip has developed the PIC24F Starter Kit for Intelligent Analog. The analog header that accompanies the kit can plug directly into the board; Sensors can also be connected to the board itself, which can in turn interface with the analog header. As Jason explained, “We designed the board to be very clean; [the] analog signals are routed away from digital so you’ll get the best representation of the analog you need to conceive of coming out of the header.”

To make things interesting for designers who get the developer kit and showcase the capabilities of the LCD display, Microchip has included onboard sensors with associated demos and menus. These include a microphone demo, a headphone demo, and a light sensor demo. There is also a demo revolving around the A/D convertors themselves. To assist with the programming, Microchip has even thrown in a built-in programmable debugger.

PC for lab software, the board itself, and a USB cable is everything a designer needs to get started on developing a prototype for an end application. With the release of the GC Family, concluded Jason, “We are trying to anticipate all the things that our designers [of] portable applications would want to do and put that on our board in terms of hardware and software so that they can leverage that to the maximum extent.”

MLX90614 SMBus Implementation in PIC MCU

This document presents the MLX90614 infrared thermometers SMBus communication in PIC microcontrollers. This document also describes the applications of the infrared thermometers, as well as typical circuit examples and an assembler and C example of the development tool used.


This application note describes how to implement SMBus communication with MLX90614 Infrared thermometers. Code is for Microchip’s PIC18. The example is MLX90614’s RAM reading. Software implementation of SMBus communication is used so the source code can be migrated for other families 8 bits PIC MCU with small changes. The development tools used are MPLAB IDE and MPSAM (Microchip Assembler) which are free to use and MCC18 (MPLAB C18 Compiler) for which an evaluation version is available from Microchip official website.


  • High precision non-contact temperature measurements;
  • Thermal Comfort sensor for Mobile Air Conditioning control system;
  • Temperature sensing element for residential, commercial and industrial building airconditioning;
  • Windshield defogging;
  • Automotive blind angle detection;
  • Industrial temperature control of moving parts;
  • Temperature control in printers and copiers;
  • Home appliances with temperature control;
  • Healthcare;
  • Livestock monitoring;
  • Movement detection;
  • Multiple zone temperature control – up to 100 sensors can be read via common 2 wires
  • Thermal relay/alert
  • Body temperature measurement


The connection of MLX90614 to MCU is very simple. Two general-purpose pins RC3 and RC4 of the PIC18 are used. Two pull-up resistors R1 and R2 are connected to Vdd and to SCL and SDA lines respectively. C1 is the local power supply bypass decoupling capacitor. The MLX90614 needs that for bypassing of the on-chip digital circuitry switching noise.

C2 has the same function for the microcontroller. The well-known value 100 nF (SMD ceramic type) is typically adequate for these components. Note that the power supply typically needs more capacitors (like 100 µF on voltage regulator input and output), not shown in the schematic.

The components R1, C3, C4 and Y1 are used for the MCU oscillator. On-chip RC oscillators can also be used. For example, with a PIC18F4320 internal RC oscillator set to 8 MHz can be used without problem. SMBus is synchronous communication and therefore is not critical to timings. Refer to MLX90614 datasheets, AppNote, “SMBus communication with MLX90614” and SMBus standard for details. MLX90614 comes in 5V and 3V versions. PIC18LF4320 could be used with the 3V version (MLX90614Bxx) and both PIC18F4320 and PIC18LF4320 – with the 5V version (MLX90614Axx).

Development Picks Up The Pace with PIC® Microcontrollers

When considering a microcontroller for your system’s hardware design, many factors must be considered. Although specifications and performance metrics are important, they only tell part of the story.

Any hardware design engineer can attest that ease of development, scalability, and excellent engineering support are invaluable to the successful release of any microcontroller (MCU)-based product. Microchip addresses these concerns through shared peripheral support across the PIC MCU product family, so code becomes more reusable. Development is also simplified via a unified and completely free MPLAB® Integrated Development Environment (IDE) which supports all PIC MCUs. And of course any PIC MCU also comes along with a host of technical documentation, software examples, hardware reference designs, and highly responsive customer support.

Microchip is a leader in the microcontroller market, offering a complete range of microcontroller devices. The 8-bit MCU families include the PIC10, PIC12, PIC16, and PIC18 series of MCUs. The 16-bit families include PIC24 MCUs and dsPIC33 Digital Signal Controllers (DSCs). The 32-bit PIC32 family offers the highest performance and the largest integrated memories in the PIC product line 8-bit MCUs have a pin count ranging from 6 to 100 pins, 16-bit MCUs have a pin count ranging from 14 to 144 pins, and 32-bit MCUs have a pin count ranging from 28 to 144 pins. Performance scales from a maximum of 16 MIPS in 8-bit MCUs, through a maximum of 70 MIPS in 16-bit MCUs, up to a maximum of 330 DMIPS for 32-bit MCUs. Integrated Flash (non-volatile) memory capacity varies similarly, with a range of 0.5-128KB for 8-bit, a range of 4-1024KB for 16-bit, and a range of 16KB to 2MB for 32-bit MCUs.

Microchip PIC MCUs offer the widest operating ranges available. The supply voltage input can range from 1.8V to 5.5V. Some device families support an ambient temperature of up to 150°C. Additionally, the eXtreme Low Power (XLP) 8-bit and 16-bit PIC MCUs offer industry-leading power consumption performance over a full range of package sizes. Run currents start at only 30 µA/MHz (8-bit) and 150 µA/MHz (16-bit), while sleep currents are as low as 9 nA. If outright performance is the goal, the Microchip 16-bit and 32-bit PIC MCU families offer the industry’s highest performance. If small form factors are paramount, packaged parts as small as the 8-pin 2 × 3 DFN are available. Microchip also continues to improve its product offerings: since 2009, over 140 new PIC MCUs have been added to the product portfolio, offering a range of industry-critical technologies such as integrated security engines, advanced analog capabilities and Core Independent Peripherals (CIP). Low-cost options abound, with MCUs supporting USB and 192-pixel segmented display drivers available for less than $1 (in quantity).

One key benefit of the Microchip PIC MCU ecosystem is the strong scalability between microcontroller families. Some integrated peripherals are available across the entire portfolio, such as Capture/Compare/PWM, timers, comparators, I2C, SPI, UART and touch sensing. Beginning with the 8-bit PIC16 MCU family, peripheral support is available for Intelligent Analog (Op Amp, DAC, and 12-bit ADC), USB, motor control, and segmented LCD. PIC18 devices and above support the CAN bus, and PIC24 devices and above also support integrated graphics drivers. Ethernet support is available on the PIC18 and PIC32 MCU families. These integrated peripherals do more than reduce CPU overhead, lower bill-of-materials (BOM) cost, and enable smaller system PCB sizes.

Because the peripheral support is shared amongst many of the PIC MCU families, there is reduced development overhead. In addition, many PIC MCU families share pinout/package footprints.

Therefore, the development code doesn’t need to change when interchanging PIC MCU designs. As a result, the system architect can spend less time worrying about the selection of the specific PIC MCU at the onset of the design. When more specifics are known about the product later in the design cycle, the microcontroller can easily be scaled without losing development effort. MCUs with the same pinout/footprint can even be scaled without impacting PCB layout.

As alluded to earlier, hardware specifications alone don’t win over the hardware/system design engineer. So perhaps the most compelling argument in favor of Microchip PIC MCUs over alternative solutions is their shared development environment. In fact, every MCU within Microchip’s expansive product portfolio (900+ components) is supported by the free MPLAB IDE. The latest version, known as MPLAB X IDE, is now based on the open-source NetBeans platform. It includes cross-platform support for Mac OS X®, Linux® and Microsoft Windows® operating system software. MPLAB X IDE also includes new features such as “one click” for automatically making, programming and running/debugging code on the PIC MCU, support for multiple compiler versions/debug tool versions, and improvements to the user interface of the MPLAB GUI.

MPLAB X IDE can be used for project management, code development, MCU programming and also code debugging. It not only provides a single IDE for development and debug of all Microchip PIC MCUs, but also provides a wide range of standard code libraries, including TCP/IP stacks and USB drivers. Many compilers are supported, including MPLAB XC8 (C compiler for 8-bit PIC devices), MPLAB XC16 (C compiler for 16-bit PIC devices), and MPLAB XC32 (C/C++ compiler for 32-bit devices). The MPLAB IDE also is supported by many third-party devices (PICAXE, etc.). In essence, this means code is easily portable between MCUs, reducing the amount of new code that must be developed and enabling the reuse of existing code.

Excellent support is a necessity for timely product deployment. Microchip has hundreds of highly trained application engineers on staff, who can assist in debugging technical issues as well as provide insight into the more advanced features within the ecosystem of MCUs and software tools. Microchip and their global distribution network offers support to customers of all sizes. In addition, PIC MCU customers have access to numerous reference designs and low-cost development boards for rapid product prototyping. Many example software programs are available for becoming familiar with MPLAB X IDE. Microchip also offers extensive technical documentation and application notes for thorough assistance with implementing PIC MCU features and capabilities. Even more assistance is available through Microchip’s comprehensive training resources, which include web seminars, hands-on training sessions, “lunch & learns”, and customer conferences. Microchip’s online forums provide a convenient and simple way for individuals to interact with the large, global community of over 60,000+ engineers and developers using PIC MCUs in their own systems.

As of 2015, the total embedded systems market continues to grow. Pre-existing markets such as energy meters and monitoring, lighting, security, automotive, and smartphone accessories are still expanding. New markets such as medical instruments and Internet of Things (IoT) devices promise even more applications for embedded systems. Meeting the demand for such a wide variety of embedded system designs will require companies to leverage internal software and hardware development across multiple different product lines. Engineering and development resources must be used efficiently for reduced product time-to-market.   Selecting Microchip PIC MCUs for your system design provides you with industry-leading hardware performance, scalability due to pin and code compatibility, and easier, platform-independent code development via the free MPLAB IDE which supports all Microchip MCUs. As a result, you will benefit from easier design-in and a more effective use of development resources, which will significantly speed your product’s time to market.

Pic Microcontroller Introduction

PIC is a Peripheral Interface Microcontroller which was developed in the year 1993 by the General Instruments Microcontrollers. It is controlled by software and programmed in such a way that it performs different tasks and controls a generation line. PIC microcontrollers are used in different new applications such as smart phones, audio accessories and advanced medical devices.

There are many PICs available in the market ranging from PIC16F84 to PIC16C84. These types of PICs are affordable flash PICs. Microchip has recently introduced flash chips with different types, such as 16F628, 16F877 and 18F452. The 16F877 costs twice the price of the old 16F84, but it is eight times more than the code size, with more RAM and much more I/O pins, a UART, A/D converter and a lot more features.

PIC Microcontrollers Architecture

The PIC microcontroller is based on RISC architecture. Its memory architecture follows the Harvard pattern of separate memories for program and data, with separate buses.

1. Memory Structure

The PIC architecture consists of two memories: Program memory and the Data memory.

Program Memory: This is a 4K*14 memory space. It is used to store 13-bit instructions, or the program code. The program memory data is accessed by the program counter register that holds the address of the program memory. The address 0000H is used as reset memory space and 0004H is used as interrupt memory space.

Data Memory: The data memory consists of the 368 bytes of RAM and 256 bytes of EEPROM. The 368 bytes of RAM consists of multiple banks. Each bank consists of general purpose registers and special function registers.

The special function registers consists of control registers to control different operations of the chip resources like Timers, Analog to Digital Converters, Serial ports, I/O ports, etc. For example, the TRISA register whose bits can be changed to alter the input or output operations of the port A.

The general purpose registers consists of registers that are used to store temporary data and processing results of the data. These general purpose registers are each 8-bit registers.

Working Register: It consists of a memory space that stores the operands for each instruction. It also stores the results of each execution.

Status Register: The bits of the status register denote the status of the ALU (arithmetic logic unit) after every execution of the instruction. It is also used to select any one of the 4 banks of the RAM.

File Selection Register: It acts as a pointer to any other general-purpose register. It consists of a register file address, and it is used in indirect addressing.

Another general purpose register is the program-counter register, which is a 13-bit register. The 5 upper bits are used as PCLATH (Program Counter Latch) to independently function as any other register, and the lower 8-bits are used as the program counter bits. The program counter acts as a pointer to the instructions stored in the program memory.

EEPROM: It consists of 256 bytes of memory space. It is a permanent memory like ROM, but its contents can be erased and changed during the operation of the microcontroller. The contents into EEPROM can be read from or written to, using special function registers like EECON1, EECON2, EEDATA, etc.

2. I/O Ports

PIC16 series consists of five ports, such as Port A, Port B, Port C, Port D and Port E.

Port A: It is a 16-bit port, which can be used as input or output port based on the status of the TRISA register.

Port B: It is an 8-bit port, which can be used as both input and output port. 4 of its bits when used as input can be changed upon interrupt signals.

Port C: It is an 8-bit port whose operation (input or output) is determined by the status of the TRISC register.

Port D: It is an 8-bit port, which apart from being an I/O port, acts as a slave port for connection to the microprocessor bus.

Port E: It is a 3-bit port that serves the additional function of the control signals to the A/D converter.

3. Timers

PIC microcontrollers consist of 3 timers, out of which the Timer 0 and Timer 2 are 8-bit timers and the Time-1 is a 16-bit timer, which can also be used as a counter.

4. A/D Converter

The PIC Microcontroller consists of 8-channels, 10-bit Analog to Digital Converter. The operation of the A/D converter is controlled by these special function registers: ADCON0 and ADCON1. The lower bits of the converter are stored in ADRESL (8 bits), and the upper bits are stored in the ADRESH register. It requires an analog reference voltage of 5V for its operation.

5. Oscillators

Oscillators are used for timing generation. PIC microcontrollers consist of external oscillators like crystals or RC oscillators. In case of crystal oscillators, the crystal is connected between two oscillator pins, and the value of the capacitor connected to each pin determines the mode of operation of the oscillator. The different modes are low-power mode, crystal mode and the high- speed mode. In case of RC oscillators, the value of the Resistor and Capacitor determine the clock frequency. The clock frequency ranges from 30 KHz to 4 MHz.

6. CCP module:

A CCP module works in the following three modes:

Capture Mode: This mode captures the time of arrival of a signal, or in other words, captures the value of the Timer1 when the CCP pin goes high.

Compare Mode: It acts as an analog comparator that generates an output when the timer1 value reaches a certain reference value.

PWM Mode: It provides pulse width modulated output with a 10-bit resolution and programmable duty cycle.

Other special peripherals include a Watchdog timer that resets the microcontroller in case of any software malfunction and a Brown out reset that resets the microcontroller in case of any power fluctuation and others. For better understanding of this PIC microcontroller we are giving one practical project which uses this controller for its operation.

Street Light that Glows on Detecting Vehicle Movement

This LED street light control project is designed to detect the vehicle movement on highway to switch on a block of street lights ahead of it, and to switch off the trailing lights to save energy. In this project, a PIC microcontroller programming is done by using embedded C or assembly language.

The power supply circuit gives the power to a whole circuit by stepping down, rectifying, filtering and regulating AC mains supply. When there are no vehicles on highway, all the lights remain off so that the power can be saved. The IR Sensors are placed on either side of the road as they sense vehicles’ movement and in turn send the commands to the microcontroller to switch on or off the LEDs. A block of LEDs will be on when a vehicle approaches near it and once the vehicle passes away from this route, the intensity becomes low or completely switched off.

The PIC microcontroller projects can be used in different applications, such as video games’ peripherals, audio accessories, etc. Apart from this, for any help regarding any projects, you can contact us by commenting in the comment section.