Friday, September 5, 2008

SPICE simulations for board level design

What trigger me to write this article is base on a question raise by one of trainee engineer in my present company. While I was drawing some schematics file, he asked me did i use SPICE simulations to get the correct circuits or put the correct value. I answer "no". Then he ask back, how do u know it's correct?.

When you do board level design, many sub-block is basically a recycle of sub-block that u had known before or that u already understand. If u understand very well during electronics course at university, u will know how transistor switch circuit is, class A amplifier, class AB amplifier, low pass filter, high pass filter, etc. This is the sub-block that when connected, it makes a circuits that target your applications. You should have a good sense on the how big the value of resistor should be, the kind of transistor u need to put and u actually can do the calculations by hand.The important things is, you must understand the qualitative analysis first. SPICE just help you to get a very very accurate quantitative analysis.

Another reason for not using SPICE is that, board level design consist of using a lot of ICs. The fact is, no IC manufacturer would give u SPICE models for their IC. You can get SPICE models for transistor, diodes, resistors and other passive elements, but u wont get for the ICs. Imagine design consist of using PIC16F84A MCU, I don't think Microchip release the SPICE models for it.

How do u get the correct circuits? For board level design, you always make prototype first. You get the prototype PCB, solder the componets, load the firmware and you power up the board.From the design, u know that it should behave this way, and the voltage or current value at those point should give this and that value. If it doesn't, you desolder some components, solder other components with different value, repeat this few times until you get what you want. Basically that's how it been done.

What is the purpose of SPICE? SPICE is certainly being use in IC design. I had experience working for fabless IC design company to understand this. The reason is, IC prototype is very very much expensive compare to PCB prototype. The IC designer try to get as accurate as possible the design. If the IC wont work, you cannot desolder or cut some wire to make it work. Basically, it just means that the prototype fails. The way IC being design also, make it possible to use SPICE. Inside the IC, it consist a lot of transistors,diodes,resistor connected together. You don't have another IC inside an IC.

What I try to point to is that, you must have very strong understandings of circuit theory and operations. Stuff like kirchoff voltage law, current law, transistor operations,etc should be well understood. In other way to see it is, you should able to run SPICE simulations inside your head before you could actually use the SPICE programs effectively.

Wednesday, September 3, 2008

First MCU Experience

My first experience doing work using MCU was when I work as engineer in one of Japannese multinational company in Malaysia. I was not involve in any embedded product development. I was a design engineer for department that produce TV tuner. The tuner that we use at that time, use Texas Instrument PLL IC for controlling the local oscillator. It is control using I2C protocol. The device that use to send I2C signal to the tuner came from Japan and we had to buy it quite expensive. No one at that time knew how to make our own.

Later, I met this one customer name Mr Vakku. He was embedded engineer developing firmware for LCD TV for one of the company in Shah Alam. I ask him how to get started using MCU because i know it could solve our I2C tuner problem. He asked me to buy one book title "Programming and Customizing PICmicro Microcontrollers" by Myke Predko. (You can get the book from Amazon.com).


The reason he recommend the book for beginner because the book come with a PCB and software to make the MCU programmer. With that, I went to "jalan pasar", quite famous place for electronics hobbyist in Malaysia to get their electronics components. Then, I assemble and solder the component and the programmer finally done.
The MCU I used is the Microchip PIC16F84A. It was chosen because a lot of example in the book was base on that and you could find huge resource on the net base on the IC. Then, when I got free times I slowly learn and develop the product using the IC. Finally I manage to develop a breadboard design for the I2C PLL controller.
Unfortunately, before I could show the design to my management, I resign from the company because I got better opportunities. Whatever it is, the knowledge that I gain from doing that stuff valuable to me until today.

Sunday, August 31, 2008

8bit, 16bit, 32bit, what this numbers really mean..?

Most of us might already hear the term 32bit processor, 8 bit processor, AMD64, IA32, etc
We probaly know that the bigger the bit number, the better the performace of the microprocessor. But do we actually know what these bits number really mean and how it effect the overall performace of a processor..?

Processor communicate with the memory either internaly or external through what is call as address bus and data bus. The bigger the size of address bus, the bigger the memory size it can access. Example:- 16bit memory bus of 8052 microcontroller can access up to 65KB of memory.

Data bus on the other hand, is the bus that hold the data that will read or write from memory.
8bits data bus means that, at one particular read or write instruction cycle, only 8bits or 1byte can be transfer at one time.

Bits number of a processor represents the width or size of data bus

Below are list of processor or microcontroller that fall under 8bits processor:-
Intel 8088, Microchip PIC16F84A, Atmel AVR, Motorola 6800, etc

Basically it's conclude that, the bigger the data bus width, the faster the processor become because the huge number of bytes can be transfer at a time.

Saturday, August 30, 2008

Microprocessor vs Microcontroller

This article will explain the different between microprocessor and microcontroller. Rather that we go straight to formal definition of both, it much easy to understand by looking at the example.
Below are names of microprocessor:-

Intel 8086, 8088, 80486, Pentium, Motorola 68000, AMD64

Below are names of microcontroller:-

Microchip PIC16F84A, Motorola MC68HC11, TI MSP430, Atmel AVR

Firstly, we describe what both have something in common. Both have a basic operations of a microcomputer. It has central processing unit, that fetch, decode, execute and writeback of machine instructions. It could be a simple loading data from memory and store to another locations. Or complex math operations to work on vector data.

The different between microprocessor and microntroller is the amount of peripheral that is put on a single IC (integrated circuits). The microprocessor IC alone wont make much use by itself. Other peripheral such as memory, video controller, ethernet,etc will make it become useful. With all this peripheral or support device connected together it will then become a router, PC, thin client,etc. Familiar stuff that we all see in our everyday life.

Microcontroller on other hand, have most of the peripheral put on the single IC. It has both volatile and non volatile memory, serial transceiver, general purpose IO, etc. By having all the peripheral inside, it will make the final device more compact, portable and low power. You could still design a blood pressure monitor or digital camera using a microprocessor but you will not get the shape and size that you see today on the device.

Why not make everything a microcontroller..?
Microprocessor is design in mind to do best in pure processing. It will have a very big data bus (32bit, 64bit), high clock speed, pipeline architecture, big instructions sets, etc. Much of silicon area on the IC are for this purpose, pure processing. In order to communicate with the outside, it has memory and data bus where all the peripheral can connected to. That's why the computer you are using able to run Microsoft Windows, open a word document, internet explorer and all sort of multitasking stuff.

Microcontroller is design to be as compact as possible. If you want to use a microcontroller as a digital camera, it has peripheral built into it for that purpose. By doing that, it will reduce the component count for the product. It also manage to make power consumption low and suitable for being portable and battery operated.

Monday, August 25, 2008

Embedded system example "Washing Machine"

In order to explain what is embedded system, it's easy to describe an everyday product that become and embedded system. For this I choose washing machine. Below is a sequence of activity of process that makes a typical washing machine (WM):-

  1. Once finish loading all the dirty laundry inside, push START button
  2. WM will measure the weight of the laundry to determine the load
  3. WM will open the inlet valve to let the clean tab water into the WM
  4. Once the water level reach certain level, base on the load measure in step 2, the inlet valve will close.
  5. the rotating drum of the WM will move to start washing
  6. once finish wash cycle, the outlet valve will open to release the dirty water
  7. sensor will detect once all the dirty water been flush out to close the outlet valve
  8. the inlet valve turn on to let clean water in for the rinse cycle.
  9. once the water reach certain level, the inlet valve will close
  10. the rotatiting drum of the WM will move to start rinse cycle
  11. once finish rinse cycle, the outlet valve open to release the dirty water
  12. sensor will detect once all the dirty water been flush out to close the outlet valve
  13. step 8 - 12 will be repeated few times depend on the program setting
  14. the rotating drum will move to start spin cycle
  15. end of spin cycle, the WM process end. FINISH

All the above mention steps can be done manually but it will defeat the whole purpose of living in this century. The whole process can be fully automated, thank to embedded system. It transform our life to be very very efficient. Time save!!