Thursday, July 30, 2009

PIC Micro Hardware Programming Methods

Here the info about PIC Micro Hardware Programming Methods

There are three ways to program a PIC microcontroller

1. Using normal programming hardware (HPV high voltage programming).
2. Low-voltage programming (LVP).
3. Bootloading.

The first two methods use the port for programming of PIC microcontrollers Label ICSP (in circuit serial programming).

This interface is between the pins of the microcontroller and after programming the pins back to normal operation, microcontroller.

Note: To work correctly ICSP you have to consider the implications and requirements of the ICSP programmer, eg an HPV-high voltage lines Vss to the PIN number (the circuit must be able to view the high voltage - up to 13V). Also, the burden of other signals PGC and PGD should not be too high, ie not in a PIN-LED at 20 mA - if the amount of tension, which is not high enough in the inputs of the PIC for programming.

It is very easy to use for ICSP through isolation of the normal resistance of the circuit and not with heavy loads on these pins.

ICSP provides 6 connections from the pic ICSP programmer to the Board as follows:

VPP - (o MCLRn) Programming voltage (usually 13V).

Vcc - Power (typically 5 V).

GND Ground (zero volts).

PID - data port and connection RB7 usual.

PGC - Clock and the port RB6 usual.

PGM - LVP enable connection and the connection RB3/RB4 usual.

PIC Micro: High Volt Programming

To use the first method of a hardware interface that is needed or "PIC programmer" to the interface between the programming software (usually on the PC) and the PIC chip. The team has the information from the PC through one of the three interfaces that are either:

* The RS232 COM port
* The parallel interface
* The USB port

You choose the interface you want to use, then choose a PIC programmer. The PC communicates with the hardware generation of the series (ICSP) to signals from the PIC hex file into a standard for the target microcontroller.

Note: Almost all ICSP PIC microcontroller with the interface, so once you have an HPV program can all PIC microcontrollers. For example, you can 12F675, 16F84, 16F88, 16F877 (A), 18F2550, 18F452 etc.

There are several programs for programming PIC, for example Micos ICPROG different hardware and software.

PIC Micro: Low Voltage Programming (LVP)

LVP is exactly the same as HVP except:

* The Vpp voltage is at the normal voltage.
* The PGM pin indicates the programming mode.

Note: In this mode, you can not with the PGM pin something else that it is solely to LVP control.

Devices with PGM mode is activated, and the only way to shut down the PGM program has an HVP programmer.

Note: Some PIC microcontrollers can only method of HPV for LVP method you have to sacrifice a PIN code - PGM - (to tell the PIC Micro either planned (eg, high voltage 5V) or not programmed, ( 0 V)) and some PIC micros only 8 pins eg 12F675. For this chip the PGM pin is not available HPV is the only way.

The real advantage of using the LVP mode, which can be programmed PIC Micros number on a board without a single program - that each additional string to a micro-Micro-Master's program and then each in turn - and this is only possible from the Vpp signal is a normal level of logic in LVP mode.

PIC Micro: Bootloading

Bootloading each interface for a program to memory. It requires a bootstrap program interface to interpret and translate the data into the memory of the installation program.

Note: Please note that only the new devices are able to program your own store, you can use this method.

Normally, a serial interface is used to bootstrap and bootloading program PIC microcontroller to wait for some time after turning the handset into the serial port to a reserved word says that the program that begins to open, to hear the order of characters that are normally not in the interface

If this boot sequence in hexadecimal mode when a file to the interface on the microcontroller. He interprets these programs and the memory of the microcontroller and then starts the program.

There are two problems with this method:

1. You have to program the boot code using HVP or LVP.
2. Use some of the microcontroller resources.

Once programmed, offer a convenient solution to the device, as you do not need programming hardware and most important advantage is that you can re-program a device without undo the computer, for example if in a field until they could return to their project programmed using the serial port!

Monday, July 27, 2009

Choosing a Microcontroller

What you need to know when choosing a microcontroller.

Gone are the days when there were less than a handful of micro-controller to choose. The fact is, the choice of a controller for a new product is an arduous task and is beyond the scope of this article, but will be discussed in more detail in a future article.

But the choice of a microcontroller to "play" for your first project is a little easier and the tools (hardware and software?) These days are very cheap if not free !....

In the past, emulators, programmers etc to use thousands of dollars (what are they thinking?). Now you can get a very low cost development tools.

10 years, I chose to go with Microchip. Why? And not only that a free development environment (MPLAB IDE), but also tons of support through forums and application notes on its website.

At that time, my project is essentially a simple electronic switch. So after withsuch easy, almost all the microorganisms that work.

Choose one of the lowest number of micro PIC12xxx. These little babies were around 512 bytes of OTP (One Time Programmable) ROM and approximately 25 bytes of RAM! (you can run Windows XP ... I think not !!!). Much he had in mind, however.

Today, there are many more vendors (TI, Atmel, etc.) that offer support and also excellent.

A relatively new "actors" who are out of the crowd is Cypress' PSOC mixed-signal set of micro-controllers. These devices are very flexible in terms of new equipment. The other big advantage of these devices is the ability, using their free tool (from now DiseƱador PSOC PSOC Express) in its program of micro-controllers without writing a single piece of code! ... Learn more about these in another article.

So if you are starting in this fascinating field, keep it simple and start with a low micro. Most vendors provide free samples of their Web sites listed below.

* TI - Texas Instruments
* Microchip Inc.
Cypress *

There are many others, but they were the main actors, I am interested in

Sunday, July 26, 2009

How Modems Work

Here what you need to know about modem.

A modem can be external or internal system with the PC. It is a device that turns your computer to your phone to transfer data over the Internet.
Hardware or an external modem has three data components of a micro-controller, checks the data for errors and compresses it with commands for sending and receiving signals. Then it sends the data to the data dump from a unit, the unit of data access. The data dump unit receives instructions from the ROM and the output is sent to the unit of data access, a hardware interface for the telephone switching system, so that the support interface pipeline.This order to recognize the modem signals line with the dial tone, busy tone, etc.
All the modems operate on the principle of point-to-point protocol theory. The modem is connected to the Internet Service Provider, and this in turn is connected to the Internet. Here are the data stored in the TCP / IP packets. The team of the TCP / IP is the TCP / IP datagram and sends them to the modem. It is the duty of the ISP to forward this datagram to the Internet.

Saturday, July 25, 2009

The Function Of Thermostat

Here's some info about the function of thermostat.

When it is cold, we walk over and turn the thermostat, and when it is hot, and he walked to turn the air conditioner to cool us. But how this small box on the wall, in fact control the temperature of our homes or offices? A mechanical thermostat is actually a very simple device. It is basically a thermometer attached to a switch that turns on the heater, if your heat source is natural gas or electricity. If you remove the cover of your thermostat, you can see the inner workings and have a better idea of how a thermostat. The top layer is mercury thermometer and a coil. Mercury is a small vial filled with liquid metal, mercury. In this bottle son are three: one at the bottom, one to the left of the road, and one to the right of the road. As the temperature rises or cools, the vial of mercury is tilted to the right or left of the corresponding wire in contact with the cable that runs along the bottom. If the mercury is at the far left, there is a link that creates a current that drives a relay which starts the heater and circulating fan. In the room is heated, and once the road turned to the balance, the connection is broken, causing the heater to turn off. If mercury is tilted to the right, another relay to power air conditioning. What are tips from the road in both directions is the thermometer coil that rests against the bottle of mercury. The temperature of the coil consists of a bi-metallic strip of two different types of metal, usually copper and iron, which are glued together. Because the response to different metals at different levels of heat, and that contracts and expands causing the coil to uncurl as wind or temperature changes. This twisting motion is tilted or uncurling vial of mercury, then the signals from the heat source or to start over. By adjusting the thermostat, which are actually adjusting the tightness of the coil. Below the top layer of your thermostat, you can see the circuit board that houses the son of the actual implementation of the fan and the heat source. The circuit is connected to the mercury through a screw and son metal, which "reads" and turn the switch on heating or cooling device. New on the market are digital thermostats. These differ from the mechanical thermostats thermostats that use of a thermistor, an electrical resistor whose resistance changes with temperature. The microcontroller in a digital thermostat measures the resistance and converts that number to a temperature reading. Digital thermostats can save energy because it can be programmed to activate the heating or air conditioning is turned off, or at preset times of the day. For example, you can adjust the air conditioning to come in an hour before returning home to work, or have the heater stays off during working hours while you and then turn on one hour before returning at his home is cozy and warm when you open the door.

Thursday, July 23, 2009

Adding a Keyboard and LCD to a Microcontroller

This article is about how to adding a keyboard and LCD to a microcontroller

One of the problems in using a microcontroller is that unlike a PC there is no user interface i.e. No screen or keyboard.

Reading Keys

There are many ways to read a keyboard depending on what you need to do for example:

1. Add an individual key to each input port (with pullup resistor).

2. Multiplex many keys to a few inputs (using the tristate microcontroller capability).

3. Interface a PC keyboard (using a serial interface).

4. Use a built in ADC to read a set of resistor coded key inputs.

...and probably many more methods.

Text output

Generating text output is more complex because there are no simple devices to do the job but there are two easy choices either:

  • Serial port to PC
  • LCD

Serial Port

Using a PC serial port is fairly easy and only requires a level translator chip e.g. MAX232 then you can output text data to the PC screen. This is useful for debugging and developing a PC based application but no good for stand alone operation. For that you need to use an LCD.

LCD

The simplest LCD interface is a 16 by 2 line LCD module usually using the standard HD44780 controller. The controller makes it easy to use the LCD as all the difficult LCD interface is contained within the HD44780. All you need to do is send it the correct data through a parallel interface to display a character.

LCD Debugging

You can also use the LCD as a debugging tool since the data displayed is retained on the display while power is applied so there is not much processing overhead in using an LCD. Another advantage over the serial display is that you can update it very quickly e.g 1 character in 40 microseconds compared to milliseconds for the serial interface (depending on serial speed selected).

LCD problem

The only real problem with the LCD is that is takes up a lot of pins 11 (if you use the full 8 bit interface) but you can reduce this by using the nibble interface to 7 pins and reduce this further to 6 if you don't need to read from the device (HD44780 has RAM inside).

Another option if you have very few pins is to use a serial LCD and this uses just one pin. Obviously this is slower as it uses a serial protocol and it is also more expensive as the serial LCD will need a serial to parallel controller on board.

Programming

For both methods modern compilers fully support the device i.e. RS232 and HD44780 so you don't need to start coding at a very low level (the HD44780 has a complex startup sequence) and you can just plug in your chosen device start using it.

Tuesday, July 21, 2009

SPI Bus: Theory and Implementation

This article discussing about theory and implementation of SPI Bus.

SPI stands for “Serial to Peripheral Interface”, and it is a hardware and firmware communications protocol developed by Motorola and later adopted by everybody. The SPI Bus is used only on the PCB. I am certain some of you will ask: “Why is the SPI Bus used only on the PCB? What prevents us from using it outside the PCB area?” The SPI Bus was specially designed to exchange data between various IC chips, at very high speeds; say, at 180 MHz or even more. Due to this high-speed aspect, the Bus lines cannot be too long, because their reactance increases too much, and the Bus becomes unusable. However, if you want, you could use the SPI Bus outside the PCB at low speeds, but this is not quite practical--the SPI Bus requires 3 or 4 communications lines, which are a bit too many, when compared to 1 or 2 lines usually needed to communicate, efficiently, with field devices located outside the PCB.

Anyway, on the PCB the SPI Bus is very good, because we can practically attach to the Bus as many ICs (or devices) as we want. Please excuse me for not providing a picture of the SPI Bus, but rest assured you do not need one: the SPI Bus is so simple that you will understand everything in words.

The next question is: “Why is this SPI Bus particularly useful?” Besides from exchanging data between various IC chips, the SPI Bus is a method of multiplying microcontroller’s pins. In other words, if you have a tiny 8 pins microcontroller, you could control with that little monster few hundreds of digital Inputs and Outputs. This is impressive, and I am certain many doubt my words. Let’s explain this.

The SPI Bus contains three lines, and they can be on any general I/O controller pins. These Bus lines are: Clock, Data-In, and Data-Out. In addition, each IC connected to the SPI Bus needs an individual Enable line. Things work like this: suppose we have four devices, A, B, C, and D; all of them are wired to the SPI Bus lines, and the Bus itself is wired to seven controller pins--this is 3 Bus lines plus the 4 Enable ones. When we want to send a message to device C, we enable its Enable line first, then we send the message serially, one bit at a time. In the same time devices A, B, and D do exactly nothing, because they are not enabled.

The beauty with the SPI Bus is, it is Synchronous, meaning, when the controller sends the message to one IC, it is also able to receive data from that IC, in the same time. This particular aspect of the SPI protocol is particularly well suited for microcontroller-to-microcontroller communications.

Now, we have seen a small 8 pins microcontroller can control 4 devices (ICs) using 7 pins. Taking into account one device of type A, B, C, or D could have eight or even sixteen I/O ports, this is still far from the hundreds Inputs and Outputs I promised to you. The next beautiful thing about the SPI Bus is: one device IC can be serialized with many more of the same type! For example, we could have B1, B2, B3, B4, B5, and so on. All ICs of type B# are serialized together, and they require only 4 microcontroller pins to make them work; the Enable line is common to all of them. Next, we can use each device of type A, B, C, and D as a group of tens similar ICs.

The enabling speed of each I/O port on the SPI Bus it is slower, when multiplying microcontroller’s pins, but always take into account I/O field devices don’t necessarily need speeds of, say 1000 ON/OFF activations per second each, simply because most of them cannot handle that speed. However, there are few, very smart firmware techniques like the “barrel-shift” type of functions, which allows us to maintain high-speed messaging on the SPI Bus, even if we have hundreds of I/Os. In the same time, the “barrel-shift” functions allow for better time management inside microcontroller, so that it has more time to execute other tasks--makes sense to me! To conclude, I believe it is clear now we can, indeed, build hundreds of efficient I/O lines on a small 8 pins controller.

Further from this general presentation of the SPI Bus, you should be aware almost all ICs implement the SPI protocol in a particular way. For detailed and practical applications I suggest you visit my home site at Corollary Theorems. There you are going to discover a good tutorial book about working with hardware, firmware--including the “barrel-shift” type of functions--and software design, in general, and about few nice and practical implementations of the SPI Bus in particular.

Many microcontrollers have built-in SPI Bus hardware modules, but I was never interested too much about using them. What I do, I always design--on the PCB and for one microcontroller--one, two or more custom SPI Busses, because my custom implementations are far more flexible. Besides, practical implementation of a custom SPI Bus, both in hardware and in firmware, is really simple--trust me with this one!

Monday, July 20, 2009

How To Control 12 LED's Using 4 Microcontroller Pins

What you need to know about 12 LED's Using 4 Microcontroller Pins.

If you have ever done any electronics before you will probably be familiar with multiplexing but charlieplexing adds a new dimension. It's a technique commercially developed at Maxim by Charlie Allen hence the name but you can still use the technique in your own circuits.

Note: The actual technique has been around for some time but Maxim is one of the first companies to use it in a commercial chip.

Multiplexing simply means sharing whether it is

FDM Frequency division multiplexing

TDM Time division multiplexing

WDM Wavelength division multiplexing

Of course the other form of multiplexing which every electronic engineer uses to steer signals around a digital circuit uses standard logic gates and although not as glamorous as FDM, TDM and WDM it is a core technique for designing digital circuitry.

With a normal logic gate multiplexer you will have a minimum of two inputs that you want to select and send to a single output controlled by a control signal.

The states of the output gates are as you would expect either high (logic 1) or low (logic 0) but charlieplexing recognizes another state:

High Impedance.
Note: This is the third state in addition to 0 and 1 so it is often called tri-state.

High impedance just means switching off the output current circuit so no current can flow into or out of the output pin.

Of course high impedance output logic gates have been around for as long as digital circuits have been used mainly for accessing a microprocessor bus where each device is tri-stated to disconnect it from the shared bus while another device outputs data to the bus.

Charliplexing

Charlieplexing uses the third state to disconnect a pin from a mesh of devices so no current flows at that node and it's ideally suited for control from a microcontroller since it's easy to change the operation just by re-programming the microcontroller.

One of the uses of charlieplexing is to control many leds using very few pins. LEDs are also diodes so reversing the voltage across an LED means no current will flow. If you connect two leds to two output pins with the second diode connected the opposite way to the first one (and using current limit resistors). Setting the output pins to 01 will turn on the 1st LED while setting the output pins to 10 will turn on the 2nd LED.

Now add in a third output pin and add two diodes connected between each microcontroller pin as before. You now have 6 LEDs and by tristating each microcontroller pin in turn only two output pins are 'connected' i.e. You can control each LED individually.

You have now controlled 6 LEDs using only 3 pins normally you would need 6 individual output pins.

The formula for how many LEDs you can control is:

LEDs = N * (N-1)

  • Two pins gives 2 x (2-1) = 2
  • Three pins gives 3 x (3-1) = 6
  • Four pins gives 4 x (4-1) = 12

Advantage of Charlieplexing

Very few pins control many LEDs.

Disadvantage of Charlieplexing

Only certain sets of LEDs can be turned on at the same time.

Sunday, July 19, 2009

The Most Popular Microcontroller

What you need to know about The Most Popular Microcontroller.

Is the 16F84 too old for your electronic projects?

If you do not know what is a 16F84 is that you've never heard of the chip (R) - an enterprise, a powerful stand-alone microcontrollers. A microcontroller is simply a very small but, unlike default systems, anything inside the device. There are no external devices, such as RAM, EPROM, I / O device.

If you are a simple way for your own projects microcontroller then adjusts the bill because:

* Very small (some have 8 pins, and even less 5).
* Have internal devices.
* Are based on internal memory REPROGRAMMABLE
* Have in Timer.
* Have internal RAM.

In short, they are ideal for managing your projects - all you have to do it all.

This is one of the dramatic benefits make discreet towards conceptions, because if you have an error in a discreet design, you can debug and re-thread. With a microcontroller can only program the establishment in the circuit (with the code of simulation to discover the errors first).

Even better, the fact that you can project forward, as the internal devices operate quickly enough, for example, could be a frequency of 50MHz no external components (except the display).

Languages

It is indeed in many languages, but it is the most popular code machine. The reason for its popularity, the fact that Microchip (R), all the tools needed to develop a machine for the program code, so you find many examples of code in assembly language on the Internet.

Personally, I do not like machines coding in assembly language (even if I use it, if necessary, eg for speed), because there is an enormous amount of time compared to a high level language. Indeed, I would say it takes 10 times longer with assembler. Similarly, the assembler language is a very unstructured, which means that it is very difficult to maintain, ie, if you use a module, then the entire code Whereas, with a high degree of protection of language, the code protected areas register the error.

Microchip has several hundreds of different devices (now much improved on the 16F84), but the basic operation of each based on the initial planning, and even if you do 16F84 original (OK, it was a 16C84) You have a very good idea, as all devices.

This is the great power of the chip (R)-devices, ie you learn something with a device and you add to your knowledge of the whole - for example, programming a 12F675, 16F84 , 16F88 or 16F877, you should know that just because the ICSP interface is all. This means your learning curve is greatly reduced.

Of course, there are some devices, professional developers of driving the pin as an LCD display, but you have only default devices (good examples in the 12F675, 16F88, 16F628 and 16F877).

Peripherals

Indeed, there are approximately 15 internal standard for modern devices (-16F) in considering that the device has only a 16F84.

That is why I think the 16F84 is well underway, but it is now time to say goodbye. Other reasons are that a quarter of the size of a Memory-16F88 and now costs about 5 times more.

Note: 16F88 and 16F628 heavily on loan 16F84 with the same pinout, so you do not have problems if you already have a 16F84.

Abstract

The 16F84 is probably too old for the serious in design, because there are more recent (backward)-devices, which allows you much more capable of projects.

PIC Microcontroller Timer Calculation

Here's some guide for PIC Microcontroller Timer Calculation.

Login to PIC microcontroller timer juggle sheet calculation, calculator, and answer your needs?

If so, then you need tools to automate the process.

Calculations

Normally, you should be on the final outcome, which, in general, the clock or measure during a period. It is quite difficult, first find the information of the file, splitter and then postscalers etc.

PIC timer 0: Calculation Example

A typical example for the calculations to create a break 18ms repeat rate on PIC timer 0th

Selecting a divider report include 1:128 time interrupt (with fosc / 4 or 4 MHz / 4 = 1 MHz) and exceeded the speed of Timer 0th

1 / (1MHz/128/256) = 32.768ms

It is clear that you need more, but you can cut them into overflow on the starting point (the interruption). To do this, you need the period of the clock input of 0, is:

1 / (1MHz/128) = 128us

It's time for the timer to 0 IE

256 * 128us = 32.768ms

Thus, by manipulating the point of overflowing, you can set the period of interruption. Time is 18ms if some calculations:

18ms/128us = 140625 (next Integer value of 141)

The number of account, after the interruption of the generator. To use, timer 0, he is responsible for the following:

TMR0 = 256-143 / / 141 but loses 2 Timer 0 to load.

From that time every 128us of Timer 0 and it is exceeding the 141 (or 18ms)

141 * 128us = 18ms

TCL, scripts for PIC clock calculation

Each time you into a PIC timer you have to do this type of calculations and equipment in each timer is different and you face the fight against interruptions.

To make the process, you can simply three online (free) with modules script Tcl (Tool Command Language). You work in a fashion similar to a Java applet.

Each of these scripts is based on the characteristics of each and allows you to clock divider, or create a value with postscaler regulator. Thus, it is easy to experiment with different values, such that the result is immediately on the Web (the frequency and the remainder of each part of the timer, for example, after the divider, the register after postscaler) .

The calculation is trivial that the sliders around, until you PIC clock time and then adjust the timer value to the house on the right answer.

Thus, you can do, even if the type of operation (all without a computer in sight), for example, "I need a frequency of 15ms.

2 clock hours of the next I could be 15,136 (a 1 minute test) - perhaps I will try to clock 1 - Ah, precision 15ms (took 30 seconds for testing purposes). Simply select with Timer 0 - this 15.040ms (a ~ 30 second test).

Of course, you can also clock (internal or external quartz) as well.

Microcontroller Ebook

Here's what I found from Microcontroller Ebook.

Are you a young student in search of data from the study to learn microcontroller?

Are you a school / college students, the information in your micro-project?

Are you a man of planning to convert your old Digital on the basis of a micro-compact design?

They work in an organization and you improve your skills for micro-systems, the design?

They are all of the diversity of age, the expertise and competence. But the needs are the same. Your question is the same. Their goal is the same. It is micro-model. "

You are on the right path that you have decided to go with microcontrollers for your projects. There is no other method, with a microphone in the product.

Here are the steps and the information for you to:

1. Their knowledge and abilities:

Each person is unique, the knowledge and skills he has.

Knowledge, the "experience" and ability, "the time for a problem in the planning"

eg I am well aware of the C programming language, but I can not solve a "sort array easily."

Ie, must have knowledge of C programming is not sufficient, but you have a good ability to "analyze and solve the problem of explanation.

And this is the key and the most important characteristic necessary when working with a microcontroller integrated design.

In other words, the ability to solve problems of the so-called "logic of the development of solutions."

2. Hardware & Software

Micro-systems, the design is the combination of hardware and software.

Built-in microphone is a small chip (IC) and the hardware of the system. This small chip microcontroller for storing a "program" its interior. This is known as software.

You as a designer for a product that has both the expertise. Is this with an example:

"It gave you an easy task to design and develop a product to lower the temperature of the room"

This project requires the following elements:

1. The temperature sensor (eg, LM35)

2. A microphone (eg ATmega8 AVR) for the data of the temperature sensor.

3. A 16 car 2 lines (16x2) LCD

4. 5V DC voltage regulator (7805 based)

Once you have the loan, its time a circuit / drawings of them.

Here is the point where you start, the internal microcontroller ATmega8.

Learn about the hardware of the microcontroller and the software. The software comes with the house-or C-language.

3. Instruments and equipment

A PC / laptop, with the IDE (development environment), ISP programmer hardware, Starter Kit / target Board and some books or reference manuals or a computer with tutorial.

In the example above, we have decided ATmega8 microcontroller. This is of the ATMEL AVR and controller family. This controller is of 8 bits.

WinAVR / AVRstudio as IDE for writing.

There are many ISP programmer (hardware) on the market.

Starter Kit enables you to experiment and test your program download (blinker), the source ATmega8 microcontroller.

Books, reference manuals and computer-based tutorial is an introduction to the new exciting world of microcontrollers.

There are many others who, like the PIC microcontroller, 8051, ARM, etc.

Each family has unique features to offer, and what you have to decide which function you need most.

Cost of the microcontroller is also an important factor in selection. But also other important factors are the availability of tools such as compilers, IDE, starter kits, programmers, books and documents.
Bookmark and Share