Sunday, December 30, 2007

My Program do not run correctly on PIC18F452

Level voltage on Pins of portB of microcontroller is 2.89 V instead of +5V and the program is not running.
This happens cause of "MCLR\" is not held high .
The crystal is touching the table.

Thursday, December 27, 2007

How can I choose a microcontroller that fits my needs?

Actually there is no specific way to do that but some considerations must be taken when we choose our microcontroller.
  • The size of the program memory for example if i want to design a LED blinking system that needs at most 1 k words of program memory i will not use PIC18F452 for example that provides 16 K of program memory. I will use for example 12Fxx or 16F630....
  • The number of input/output used in the project so i will choose a microcontroller that fits that purposes for example if i want to make a timer for a serve time relay with one switch or 2 as 2 inputs and one or 2 ouputs for this timer so as i will use one port with 8 bit .... No needs of huge number of I/O s .
  • Additional integrated modules that costs me additional fees and i do not use it....for example :A/D converter,Comparators,multiple timers,SPI,USB port,........ So if my project is a pure digital system that do not need analog signal ;no need for A/D converter which is expensive .
  • Finally The speed my applications needs for example all the PIC16FXX had a maximum crystals frequency of 20 MHZ and there are applications that needs more than that frequency so we will use the PIC18FXX family instead.

Sunday, December 16, 2007

what is the best compiler for PIC microcontrollers?


First of all to be good in Microcontrollers programming you should learn something very important ;that thing is the key .....

The key is the data sheet of the device ....

In my opinion reading datasheet carefully is 90% of work ....

Also when i started learning microcontroller i learned assembly ;in my case i learned PIC family of microcontrollers....the amazing part of PIC is the smallest number of instructions; it is RISC processor which means (reduced instructions set computer)...For example the PIC16FXX family had only 32 instructions and the PIC18FXX had only 75 instructions ....it is amazing only 32 instructions and you can excute any intruction from them ......

My learning process start with :

1. writing Assembly using MPLAP

2. use PICBasic Pro compiler

3. Finally mikroC V6.2


MikroC is very good but don't miss the golden rule of learning "The data sheet"

How can we drive a Led matrix display?

Many people ask me how we can drive a led matrix display?
Driving a Led Matrix display is based on a concept named "Persistance of vision"
for example The led matrix consist of 64 leds ;theoretically we need 64 output from a microcontroller which is practically impossible so people found a good way to persist the cornea of the eye by sending the output to first column then 2nd then 3rd very fast and looping back another time from the begining with a frequency the eye can't distinguish .....
remember to drive first column you give it ground for a moment and in the same time the data are fed to 8 rows.......................

What is a Led matrix display?



A Led matrix display for example 8*8 leds is an array of leds connected in a special manner to be driven with a special way

For example at the back of this matrix there is 8 pins for rows and 8 pins for columns

if you want to make the first column "on" you should put +5V on the 8 rows and put a ground on the pins corresponding to first column .

What is the difference between microcontroller and microprocessor?

A microprocessor is a chip that should be inserted in a mainboard that provides RAM and ROM(Hard disk) plugged to it as 2 external components to the board while a microcontroller contains RAM and ROM(Flash) in the same chip to provide a complete solution in the same chip.
Sometimes other modules like analog to digital converter ,comparators ,timers, ....are integrated also in the microcontroller to enrich the solution.
Microprocessor examples: intel 8086, AMD,...
Microcontroller examples: PIC16FXX,PIC18FXX, 8051,AVR, Z80,......

Thursday, December 13, 2007

How to design using PIC microcontrollers


All you need to design PIC microcontroller projects:

  1. A pic microcontroller chip from PIC16FXX or PIC18FXX (PIC16F628 is good for Start)
  2. A PIC programmer ;try named "ujdm" driven by serial port (attached picture in blog)
  3. "PicProg" software to burn the chip ;it is free on the internet but needs some configuration
  4. Some leds and resistors for testing purposes
  5. A compiler like mikroC to begin your developpement
  6. A +5V chinese power supply to power your circuits