Embedded Toolkit Part 2: Know-how and Hardware
In Part 3, I will discuss the software that you need since its best discussed as a single topic.
Electronics Know how and Hardware: What do you need to know?
Getting a PIC to start up and flash an LED is quite simple, and a bit of savvy will get you there. The irony is that, in retrospect a PIC is essentially the composite of many disciplines in the field of electronics engineering which is delivered in a compact package for us to use.
The article intends to be a comprehensive guide, however not all information is covered and the know how essential, it would just be advisable for the sake of understanding everything in the greater context.
Firstly, you need to understand how power supplies work and how an AC voltage is rectified to produce a DC Voltage. The next step is to understand how that DC voltage is regulated to produce a voltage of nominal 5Vdc. Finally, with regards to DC voltage, appreciating the value of polarity and that it is important to ensure that the device is connected up correctly. All DC devices are polarised, i.e. +ve to +ve and negative to negative. There are a few other basics that are discussed below.
1. A Series circuit is a voltage divider: this key principle is important when connecting up devices
2. A parallel circuit is a current divider: this key principle is important when connecting up devices in such a way that they receive both the right voltage and current
3. Supply voltages should not be significantly higher or significantly lower as this will
a. Reduce the power to the device preventing it from functioning reliably, but not necessarily damaging the device or board
b. Increase the voltage to the device above the rated value as this will damage the device rendering it useless i.e. throw it away and start again with a new one
A good understating of binary, number conversion TTL Switching, Boolean Logic, Logic Gates would go along way to help you work with your device.
On a side note, buying as many books as you can lay your hands on is good initiative, but an internet search is just as effective and cheaper.
A basic circuit for a PIC is supplied below, and this brings me to the Hardware requirements. To break the key elements down:
1. The power supply regulated the incoming DC voltage to the required level. ZarDynamix’s PCBs will run at either 3v3 or 5Vdc. These are what we consider to be standard operating voltages. However, depending on the power supply that you have available, this voltage can change. For a normal type, 5vdc is the maximum and for a J type the maximum is 3v3. You can power lower however down to 1.8 volts.
2. The Programming Circuit and Pull Up resistor are an interface which 1) allows the device to be programmed with software. 2) Recover from the programming cycle and return to normal operation.
3. The Reset button forms part of the programming interface as it gives the user the ability to manually reset the device. This enables the user to restart the device in the case of the system being unresponsive or a code crash.
4. The pull up resistor supplies a voltage to the MCLR pin which when held high puts the PIC into normal operating mode. The MCLR input is used during the programming cycle and should be kept high to maintain normal operation. It does have a number or purposes as listed below:
a. Reset device
b. Reset device and supply programming voltage to erase program memory and reprogram device
c. Not all devices need the MCLR pin to be held high as this can be used as a normal input
5. Crystal Oscillator circuit is essential as it provides the device with an operational frequency. This frequency is used by the device to run the programmed software, instruction by instruction. The process is more involved that stated above. However the crystal frequency, for example 4 MHZ is divided by 4 by the internal mechanics of the device to produce the machine cycle i.e. the frequency at which one software instruction is executed; some instruction cycles take 2 machine cycles. So if you use a 4MHZ crystal your machine cycle is 1 MHZ or 1 instruction cycle runs at 1 instruction cycle at 0.000001 of a second. This is considered slow in terms of processing power but very adequate for hobbyist type projects.
The following items would be needed:
• Development PCB
• Power Supply
o Can be desktop, or
o Wall mount AC to DC Adapter
• PIC Programmer
The Development PCB is the basic hardware platform from which you develop your project. Once you have the basics in place the next step is the software.
Next in Part 3 …