Mturk Jobs

Mturk Jobs
Mturk Jobs

Tank

Friday, March 27, 2009

I wish I met you in person to introduce you to Islam

I wish I meet you in person to thank you for visiting my blog and for knowing your opinion.
And to get more ideas from all around the world about Microchip PIC.

I also want to meet you to tell you about my religion , Islam. Yes, I am Muslim. And I am proud of being a Muslim. And since I had the chance to communicate with open minded , highly educated people from all the world , I can give you an Introduction to Islam. This religion that I want to tell the whole world the truth about it and how it makes the world a better place for the humanity. So , I invite you to check this Introduction to Islam.

If you need to know more about Islam from trusted sources, you can order free book from here.

Saturday, March 7, 2009

PWM Mood Light using PIC 16F84

Generating PWM signal using PIC 16F84

PWM ( Pulse Width Modulation ) is a square signal involves changes in the duration of the on time ( duty cycle ) . It can be easily generated by the PIC 16F84 . This PWM signal can be used in many applications ( for example : DC motor speed , LED brightness intensity , Mood Light Lamps ) .

PWM can be used when no DAC ( Digital-to-Analog Converter ) is available in the microcontroller chip or as a stand alone chip. The average DC voltage values are equivalent to analoge values as where you used DAC for motor speed control .

And for light brightness intensity , at high frequency , the blinking process is not observed by human eyes and what you see is only brightness intensity corresponding to the duty cycle ( time at which light is ON)

At longer duty cycle , LED is ON for longer time , so you see it brighter.












At shorter duty cycle , LED is ON for shorter time , so you see it less brighter.




The previous examples used constant duty cycles at each time which means constant brightness LED and constant speed for motor.

To make Mood Light LED, you need to change the duty cycle of the PWM signal by increasing and decreasing it back and forth.

You get this one .


Note :

You see this image still, just click it and save it to your PC you 'll see it animating ( PWM is variable ) .



I connected this circuit to the LED and it did just as I expected , it looked brighter then dimmed and then brighter again.


You can have the circuit and the code files from here.


If you need any help configuring the compilation settings for Hi-Tech and ISIS 7 , you can check the previous posts. If you need further help about code and hardware you are welcome to contact me.





If you like this blog you can support us by many ways:
   
   1. Leave comments stating your point of view about this article.

   2. Buy our book on Amazon Learn By Making.

   3. Click on links of our sponsors without adding any extra cost on you if you make purchase from them. Actually, many of these offers are totally free.
  4. Visit our new website outatime.tech.

Thank you for visiting our blog.

Friday, February 27, 2009

Lookup table Sine Wave Generation

Sine Wave Generation using PIC 16f84A :

In this lesson, we 'll learn to use the PIC 16F84A to generate a sine wave signal using lookup table method .

These are pre-calculated values of a certain signal ( here will be a sine wave ) , then the signal is transmitted at execution time . You can consider this an inverse process of the digitization . At execution time, the signal is sent to the output port of the Microcontroller at the rate you determine. You then get the original signal.

Attached a text file that explains how I calculated the values.

The hardware circuit is very simple. It is called Resistor Ladder Network.





When you configure and run your program , you should get an output signal like this





You can get the circuit for Proteus ISIS 7 and the code from here.

If you need any help for configuring the simulator , check my older posts.

You can also contact me directly if you need any further help.




If you like this blog you can support us by many ways:
   
   1. Leave comments stating your point of view about this article.

   2. Buy our book on Amazon Learn By Making.

   3. Click on links of our sponsors without adding any extra cost on you if you make purchase from them. Actually, many of these offers are totally free.
  4. Visit our new website outatime.tech.

Thank you for visiting our blog.

Wednesday, February 4, 2009

Introduction to Interrupt : PIC16F84A



-->
What is the Interrupt?

What‘s the difference between polling and Interrupt?
Let ‘s take an example when you need to know if you have a phone call , you can know this using one of two ways :

1- Go to the telephone and pickup the handset to see if you have a phone call. You‘ll need to do this many times. And you will stop what you do every time.
2- Wait until the phone rings , then you go to it and pick up the hand-set.

Polling is like the first example and Interrupt is like the second example. You need to use interrupt in some applications. It sure decreases the load on the microcontroller and saves its time while doing another thing.
There are two types of interrupt: software and hardware interrupts.

In the following application, we will use Timer interrupt ( one of the Software interrupts ) which is initiated by the Timer0 overflow.

The timer is a free counting register that increments depending on the crystal oscillator speed and the prescaler settings. We can use the timer to calculate accurate time periods. And because we are using interrupt , we don 't have to keep track of time while we are doing another thing. In the following example , the main program functions to monitor a push button and displays a number on a 7 segment display. The number on the display indicates the period in seconds.

Without using interrupt, we would have to calculate the time of the period and taking the display time into account.





Today, I revisited this page which contains many Microcontroller projects. This is the Cornell University Electrical Engineering students projects page. Many ideas can be found here.



If you like this blog you can support us by many ways:
   
   1. Leave comments stating your point of view about this article.

   2. Buy our book on Amazon Learn By Making.

   3. Click on links of our sponsors without adding any extra cost on you if you make purchase from them. Actually, many of these offers are totally free.
  4. Visit our new website outatime.tech.

Thank you for visiting our blog.

Saturday, January 31, 2009

Input to the PIC 16f84


Now that we learned how to get output form the PIC ( flashing LED ) , we 'll learn to input the

Microcontroller by a push button . This will give you an idea to get order from the user to do an

action ( open door, turn-off lights, ......... ) .


; Button.ASM;******************************************************

list p=16f84


include "p16f84.inc"
org 0x00goto start

org 0x20

start


bcf INTCON,7

movlw 0x00

bsf STATUS,5


movwf TRISA

bcf STATUS,5

movlw 0xFF

bsf STATUS,5

movwf TRISB


bcf STATUS,5

againbtfss PORTB,0

call LED_ON


call LED_OFF


goto again

LED_ON

movlw 0xFF


movwf PORTA

goto again




LED_OFF

movlw 0x00


movwf PORTA

goto again

end
;***********************************************

The program makes the LED is ON when the Button is pressed , LED off when Button is released.

The only new command here is BTFSS which checks if the button is pressed or released.

What it makes is Bit Test F Skip if Set where F is a bit in register. This command is a

bit-oriented command. It means it deals with one bit of the register.

Build the following circuit in Proteus 7 ISIS :







Follow the steps you learned before to add the source code to the circuit and configure it , then

start simulation. Of course in this time you 'll add the Button.ASM source code.

Now , we 'll write the same program in C


//******************************************************



#include"pic.h"

main()

{

unsigned char i;



TRISA = 0 ; // Make PORTB output

TRISB = 0xFF ; // Make PORTB input

PORTA = 0 ; // Initialize PORTB

for(;;) // This is the infinite loop that keeps the PIC running

{


if ( PORTB == 0 )

PORTA = 1;

else

PORTA = 0 ;


}



}




//************************************************************

Note that the logic is inverted because the button by default inputs one to the PIC and when pressed inputs zero.

Again , you can configure the project for the C source code from this lesson.

You can download the project files and source code from here.

Enjoy.





If you like this blog you can support us by many ways:
   
   1. Leave comments stating your point of view about this article.

   2. Buy our book on Amazon Learn By Making.

   3. Click on links of our sponsors without adding any extra cost on you if you make purchase from them. Actually, many of these offers are totally free.
This means that you can enjoy something for free and still support our blog to keep posting useful stuff.


Amazon.com - Read eBooks using the FREE Kindle Reading App on Most Devices


This is the well-know Amazon Kindle platform. If you sign up for the free reader from Amazon to read any book, we get commission. 
There are many useful book for free on Amazon Kindle. Even you can find best sellers offered for free on Kindle format.
The best part is you can have the application on any platform. You can even read any book without installing any application by using Amazon Cloud-Reader on your browser.


Join Amazon Kindle Unlimited 30-Day Free Trial

You can join Amazon Kindle for 30 days free to have access to many paid book for free. You can cancel you subscription anytime.


Try Amazon Prime 30-Day Free Trial


The Amazon Prime is a special paid service from Amazon that offers good promotions and one-day free shipment for Amazon Shoppers. You can try this service for 30 days. You can cancel you subscription anytime.

Shop Amazon - Give the Gift of Amazon Prime


Try Audible and Get Two Free Audiobooks


Audible is the audio books website from Amazon. Many Kindle books are sold on Audible. You can try this service for free and get 2 free book. You can cancel you subscription anytime.


Shop Amazon - Create an Amazon Baby Registry

If you have a new baby borne or expecting one, you can create your free baby registry to easily save products and get offers and promotions on baby requirements.

  4. Visit our new website outatime.tech.

Thank you for visiting our blog.

Thursday, January 22, 2009

Building your first circuit application with PIC16F84A

Enough simulators!!

You may want to try the real circuit to see the microcontroller in action right now. I encourage you to build the circuit and feel it working. This will make you happy and will be a motivation to learn more about microcontrollers and make useful circuits.

So what do you need to get started?

- I guess you have the programming circuit and you have loaded the chip with the HEX file. If not yet, please do it now.

All you need you do is to put the chip in its socket in the programmer and open the program ICProg.

You need to configure the program as follows:

1) Form Settings menu, select Hardware.

- Select JDM Programmer.
- Select the com port you use.
- Select Windows API for Interface menu.




2) Select the microcontroller of your focus (Microchip PIC 16F84A) from the device menu.

3) Select the Flasher.Hex file to be loaded into the Microcontroller .

4) Choose HS for the Oscillator and clear WDT option.







- Build the simplest application circuit for the PIC, the LED flasher.

Here is the schematic.


Simple, isn‘t it?

You don‘t need to make it complex. The push button connected to the pin 4 (~MCLR) is connected to demonstrate how to connect the circuit if you want to reset the microcontroller. If you don‘t need to do this (in this small project) connect the pin 4 to Vcc directly (+ terminal of the battery). This connection makes the microcontroller awake (not reset).

If every thing goes right, you get the LED flashing at a visible rate. Congratulations , you ‘ve just built your first embedded project!




If you like this blog you can support us by many ways:
   
   1. Leave comments stating your point of view about this article.

   2. Buy our book on Amazon Learn By Making.

   3. Click on links of our sponsors without adding any extra cost on you if you make purchase from them. Actually, many of these offers are totally free.
  4. Visit our new website outatime.tech.

Thank you for visiting our blog.

Thursday, January 15, 2009

Let 's speed up the rate !! Compile PIC16F84A Programs

Now that we learned to flash an LED using the PIC 16F84, we 'll increase the rate of information flow.

We 'll write the same program using C language. This will be very easy as it is a popular language and it also a high-level language. Most of us used it for computer programming.

That 's the flasher program:


//************************************************

#include"pic.h"


main()

{
unsigned char i;

TRISB = 0 ; // Make PORTB output

PORTB = 0 ; // Initialize PORTB
for(;;) // This is the infinite loop that keeps the PIC running
{
PORTB = 0x00;

// turn all LEDS off


for(i = 100 ; --i ;);


// Delay


PORTB = 0xFF;
// turn all LEDS on
for(i = 100 ; --i ;);

// Delay


}
}


//************************************************


I guess the program is self explaining.

Now again, we 'll try it in Proteus to see it working.

Here are the steps to add the C source code file and compile it.

1. Copy and paste the previous code into a file named flasher.c .

2. Install the program HiTec PIC C .

3. In ISIS 7 , open the flasher.DSN model you used before.

4. On the Source menu , choose Define Code Generation Tools.

5. Press New.

6. Brows to the folder of HiTec PIC C and to Bin folder , choose picl.exe.

7. To add the source , choose Source --> Add/Remove Source files , press New to add

flasher.c
choose PICC from the drop-down menu under Code Generation Tool , and on the

Flags text box , type --chip=16f84a to choose the microcontroller type.



8. Now press Source --> Build All.

9. Now choose the oscillator speed and the flasher.HEX file as you did in the Assembly

example.



10 . Press F12 to Run the program.



Here you can find the Proteus ISIS model and the source code






If you like this blog you can support us by many ways:
   
   1. Leave comments stating your point of view about this article.

   2. Buy our book on Amazon Learn By Making.

   3. Click on links of our sponsors without adding any extra cost on you if you make purchase from them. Actually, many of these offers are totally free.
  4. Visit our new website outatime.tech.

Thank you for visiting our blog.


Tank