PIC In-system Programming

PIC microcontrollers, like most modern microcontrollers, can be programmed in system (or in circuit – ICSP) rather than in a socket programmer. This has advantages in development and in production, for example, to use different firmware for different versions or to speed up production. The major benefit though is field upgrades. We can give you lots of horror stories about people who didn’t think of firmware upgrades and had to recall products to fix a bug, not a cheap option. So how do you add In System Programming to your designs?

The major factors are the electronic design of the ICSP circuit and the ICSP connector format. Let’s look at the connector format first. Most Microchip development boards (and ICD2/3 debuggers) use RJ11 connector by default, but this is a poor choice for field or production use.

Continue reading “PIC In-system Programming” »

AVR Microcontroller C Code

The AVR microcontroller is excellent with C code because it was designed with C in mind. Atmel have also made it easy to use C in AVR Studio, as WinAVR compiler can run from within AVRStudio just like the assembler.

Only a few years ago, using C compilers involved complicated commandline instructions and make files but WinAVR more or less takes care of this for you. WinAVR is based on the free GNU-GCC compiler but is much friendlier, especially for beginners.

Continue reading “AVR Microcontroller C Code” »

PIC Hex File Format

Microchip have scored a winner over Atmel AVR by including all the information required to program a PIC microcontroller in one Hex file. This includes code, EEPROM data, User bytes (User ID) and most importantly, configuration words.

This makes it much easier to transfer the project from development to production or between engineers, as all the information needed is in one file. Atmel, now they have been taken over by Microchip have belatedly added an ELF production file format that can do the same thing. See this post for details – Producing AVR and ATxmega ELF production files So, what is this PIC file format?

Continue reading “PIC Hex File Format” »

PIC Microcontroller

PIC microcontrollers are manufactured by Microchip

They cover a huge range of devices, from tiny 8-bit microcontrollers to 32-bit advanced PIC32 devices. All PIC microcontrollers use Harvard architecture, which means that they have separate buses for data and instructions. If a device is called an 8-bit microcontroller, this means that its data bus is 8-bit, a 16-bit device has a 16-bit data bus and, guess what, a 32-bit microcontroller has an 32-bit data bus.
Continue reading “PIC Microcontroller” »

AVR Microcontroller Coding

The question we are often asked is should I start with C or assembly language to program my AVR microcontroller? Well, there are pros and cons to both approaches.

C has many advantages, including much faster code writing and increased portability. It is also much easier to understand and modify the code later. By using library files, code can be reused easily or pre-written functions can just be added by including a library.
Continue reading “AVR Microcontroller Coding” »

AVR Microcontrollers

AVR microcontrollers are available from Atmel directly, from any of their distributors or here on the Kanda site. The range covers everything from 1KB 8-pin devices to 100-pin 256KB microcontrollers.  Available package types include DIP, SOIC, QFN and TQFP. They feature all the usual peripherals including UART, SPI and Two Wire Interfaces, plus ADC, analog comparators and PWM for analog work and some have more advanced features like CAN and USB.
Continue reading “AVR Microcontrollers” »

Microcontrollers, training, electronics and coding