Archive for tag: programming

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 [...]

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 [...]

Number bases and logic

16 August, 2002 (20:57) | howtos | By: nick

Embedded programming requires at the very minimum a casual understanding of binary, hexadecimal, and logical operations. Here is a brief overview of these operations and a few sample uses.
Binary
Binary is all computers understand. It is a numbering system quite different than our “base-10″ system. In “base-10″ or decimal numbers, every digit has 10 possible [...]