Difference between revisions of "Firmware Tips & Techniques"

From diychristmas.org wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
Light controllers are essentially small computers that have a dedicated purpose. They don't have features for a keyboard or mouse, they don't have an electronic subsystem for hi-res video displays, hard disk drives or networking, but they have the ability to turn things "on" and "off," sometimes very quickly -- hundreds and thousands of times per second. To do this, the "chip" or "chips" that are inside a light controller use "firmware." Firmware for one of these chips is the equivalent of "software" for your PC. Except while you can generally control what software does on your computer because you're sitting in front of it, firmware on a chip generally runs unattended and only reacts to whatever data is sent to it.  
 
Light controllers are essentially small computers that have a dedicated purpose. They don't have features for a keyboard or mouse, they don't have an electronic subsystem for hi-res video displays, hard disk drives or networking, but they have the ability to turn things "on" and "off," sometimes very quickly -- hundreds and thousands of times per second. To do this, the "chip" or "chips" that are inside a light controller use "firmware." Firmware for one of these chips is the equivalent of "software" for your PC. Except while you can generally control what software does on your computer because you're sitting in front of it, firmware on a chip generally runs unattended and only reacts to whatever data is sent to it.  
  
From the factory, these chips are blank and do not contain the firmware control to make lights blink or fade up/down. It is up to the user to put the necessary firmware ONTO the chip. The process for putting firmware on a chip is called "flashing the chip." Once the chip has been flashed with firmware, it retains that firmware whether the chip is powered on or not. If you remove the chip from the controller, the firmware remains stored on the chip, and it remains there unless you either erase it or replace it with different firmware. Most chips can be reflashed with different firmware many tens or hundreds of thousands of times, so you don't have to worry about wearing it out. But it's important to know that the firmware for one type of chip may not work on a different kind of chip. This is because of the internal electrical design of the chips themselves -- it's not a one-size-fits-all kind of thing. Some chips have only 8 pins or "legs" while others may have 14, 16, 18, 24, or 40 pins, and each chip's internal structure is different, so you must use the firmware designed for the chip you're using in your controller or the firmware likely won't work. For example, if you drive a Corvette, you use gasoline. You can't put diesel fuel in the Corvette and expect it to run.
+
From the factory, these chips are blank and do not contain the firmware control to make lights blink or fade up/down. It is up to the user to put the necessary firmware ONTO the chip. The process for putting firmware on a chip is called "flashing the chip." Once the chip has been flashed with firmware, it retains that firmware whether the chip is powered on or not. If you remove the chip from the controller, the firmware remains stored on the chip, and it remains there unless you either erase it or replace it with different firmware. Most chips can be reflashed with different firmware many tens or hundreds of thousands of times, so you don't have to worry about wearing it out. But it's important to know that the firmware for one type of chip may not work on a different kind of chip. This is because of the internal electrical design of the chips themselves -- it's not a one-size-fits-all kind of thing. Some chips have only 8 pins or "legs" while others may have 14, 16, 18, 24, or 40 pins, and each chip's internal structure is different, so you must use the firmware designed for the chip you're using in your controller or the firmware likely won't work. For example, if you drive a Corvette, you use gasoline fuel. You can't put diesel fuel in the Corvette and expect it to run. Firmware is like that. You need the right firmware for each kind of chip.
 +
 
 +
Firmware comes in two basic formats: source code and compiled code. The source code is the human-readable format that is written/modified using common text editor tools. The source code is usually modified by the user to tweak it to his/her needs. For example, you might want the controller to use a specific communication speed so your computer can talk to it. The communication speed (i.e. ''baud rate'') is a number that you would change in the source code. Then you would use a piece of software on your computer to load the source code and "compile" it into compiled format. While the source code is the stuff humans understand, the compiled code is the machine code that the chip understands; the "compiler" transforms the source code into the machine code. Compiled, machine code is usually a "hex" file because it typically has "hex" at the end of the file name, such as pic16f688.hex.

Revision as of 08:43, 24 April 2015

Overview

Light controllers are essentially small computers that have a dedicated purpose. They don't have features for a keyboard or mouse, they don't have an electronic subsystem for hi-res video displays, hard disk drives or networking, but they have the ability to turn things "on" and "off," sometimes very quickly -- hundreds and thousands of times per second. To do this, the "chip" or "chips" that are inside a light controller use "firmware." Firmware for one of these chips is the equivalent of "software" for your PC. Except while you can generally control what software does on your computer because you're sitting in front of it, firmware on a chip generally runs unattended and only reacts to whatever data is sent to it.

From the factory, these chips are blank and do not contain the firmware control to make lights blink or fade up/down. It is up to the user to put the necessary firmware ONTO the chip. The process for putting firmware on a chip is called "flashing the chip." Once the chip has been flashed with firmware, it retains that firmware whether the chip is powered on or not. If you remove the chip from the controller, the firmware remains stored on the chip, and it remains there unless you either erase it or replace it with different firmware. Most chips can be reflashed with different firmware many tens or hundreds of thousands of times, so you don't have to worry about wearing it out. But it's important to know that the firmware for one type of chip may not work on a different kind of chip. This is because of the internal electrical design of the chips themselves -- it's not a one-size-fits-all kind of thing. Some chips have only 8 pins or "legs" while others may have 14, 16, 18, 24, or 40 pins, and each chip's internal structure is different, so you must use the firmware designed for the chip you're using in your controller or the firmware likely won't work. For example, if you drive a Corvette, you use gasoline fuel. You can't put diesel fuel in the Corvette and expect it to run. Firmware is like that. You need the right firmware for each kind of chip.

Firmware comes in two basic formats: source code and compiled code. The source code is the human-readable format that is written/modified using common text editor tools. The source code is usually modified by the user to tweak it to his/her needs. For example, you might want the controller to use a specific communication speed so your computer can talk to it. The communication speed (i.e. baud rate) is a number that you would change in the source code. Then you would use a piece of software on your computer to load the source code and "compile" it into compiled format. While the source code is the stuff humans understand, the compiled code is the machine code that the chip understands; the "compiler" transforms the source code into the machine code. Compiled, machine code is usually a "hex" file because it typically has "hex" at the end of the file name, such as pic16f688.hex.