Archive for category: howtos

Posts showing, well, how to do something.

Conditional Jumping in PIC16 Assembly

27 February, 2003 (20:51) | code, howtos | By: nick

PIC Microcontrollers have a funky way of handling conditionals. I’d like to present a set of macros I’ve made to make this easier to use, as well as explain the basics behind the technique in general.
Most MCU’s I’ve worked with before PICs had nice simple conditional statements… The mnemonic was usually to the effect of [...]

PIC buttons (interrupt-based)

23 August, 2002 (22:08) | code, howtos | By: nick

Previously, in PIC buttons (polling) we saw how to poll for the state of a line connect to a button, that is all fine and good but really that is not the best way to do them. The “real” way to interface with external components like that is through interrupts, a slick feature.
Interrupts provide you [...]

PIC buttons (polling)

22 August, 2002 (22:07) | code, howtos | By: nick

Polling for button input, how useful! This is pretty brief and gives a good idea how to let buttons control your programs execution.
In this tutorial I’ve switched from using an oscillator to using a crystal. This changes the design a bit. Using the 2 OSC pins, OSC1/OSC2 (CLKOUT/CLKIN) they hook to the crystal in parallel. [...]

PIC LED blinker (busy-wait)

21 August, 2002 (21:18) | code, howtos | By: nick

Beyond all doubt, the #1 beginning program in microcontrollers is the LED blinker. It’s super simple, and teaches the concept of pin voltages and busy-waits. Here is a busy-wait LED blinker program, and a walkthrough building it in MPLab.
First, the delay. This is a busy-wait delay program, busy-wait means you just burn instruction cycles [...]

Basic PIC16 hardware setup

19 August, 2002 (21:16) | howtos | By: nick

Your basic PIC16 microcontroller can’t hold down the fort by itself, it needs a little help from a few components.
I use a prototyping breadboard, the white kind you can just plug & unplug stuff to all day long. It makes life prototyping a whole lot easier.
Ok, now on to the PIC stuff. First and foremost, [...]

The PIC16 instruction set

18 August, 2002 (21:15) | howtos | By: nick

The instruction set is your window into controlling these chips to do your bidding. Knowing what the chips understand helps you come up with a plan of attack to solve your particular problem.
We need to get some basic info out of the way. The way variables are handled are through registers, these are 8-bit data [...]

PIC programming tools

17 August, 2002 (21:02) | howtos | By: nick

There are several tools needed to get started in programming the PICs. I’ll briefly cover some software to develop in and hardware to load the chip.
Software
I use the MPLab package by Microchip. It’s an excellent IDE and is available free for download at their site.
As I go through examples I will introduce specific features of [...]