Mturk Jobs

Mturk Jobs
Mturk Jobs

Tank

Showing posts with label PIC 16f84. Show all posts
Showing posts with label PIC 16f84. Show all posts

Wednesday, July 29, 2009

PIC 16F84 Sound Generation

Do you know that you can generate tones of sound with the PIC16F84?

Yes you can generate these tones similar to the Midi tones of the old mobile phones. This is a very simple and funny circuit and you can try it on the simulation software Proteus ISIS 7 before building it.

Actually the circuit is so small nearly contains no components other than the microcontroller, the crystal oscillator and some resistors.



The software generates the tones according to the predefined words which represent tones.

The circuit lets you choose one of two tones with two push buttons.

You can find the Proteus ISIS Design files DSN, Code ( Assembly ) and HEX file as a sample project in Proteus ISIS 7. From the menu bar , press open file . You 'll find the project under the Proteus --> Samples --> VSM for PIC16 --> PIC Doorbell.

So , open the design now and if you like , start building the circuit and make you own tones.

Have a nice time.




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, June 17, 2009

LED Chaser : Larson Scanner 16F84A . Knight Rider KiTT Car

I love LEDs !!!


In this lesson we’ll not learn any new technique from the technical point of view. But this is a cool project. I love LEDs. That‘s true. I cannot deny that. In this project I designed a nice and a simple thing. It is called a chaser. It consists of a row of LEDs. Only one LED is ON during a certain time and all the others are OFF. Then the next one is ON. And so on until reaching the last LED in the row. Then the LED before the last on is ON until reaching the start of the row. The light continues going back and forth. For those who saw the series ‘Night Rider ‘, it reminds you of the front logo of the car Kitt. It is based n the PIC16F84A





As usual, I give you the code and the design files of this project to see the simulation running on the Proteus ISIS 7 here. And for those who like it, the project can easily be built within minutes.






Here is the actual circuit









If you need any information, you can comment or send me an Email.

Thank you for dropping by.




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.

Friday, January 2, 2009

Explaining PIC16F84A Flasher Program in Detail

You may have felt that the Flasher program is difficult. But this is not true.

Now, we 'll explain it step-by-step. Just remember, when I started learning Microcontroller programming, I started by understanding this program in detail and put on it my own comments to make me remember what each piece of code did.

list p=16f84
include "p16f84.inc"

; This part is necessary for the compiler to
; know the type of the PIC you are using.

org 0x00
goto start

; The word ORG tells the compiler to put the following code ( goto
; start label ) in the address 0x00 which is the reset vector of the PIC


org 0x20

start

; Again. Puts the label start at the address 0x20

bcf INTCON,7

; Clear the R7 bit in the register INTCON which disables the interrupts

movlw 0x00

; Put 0x00 in the W register

bsf STATUS,5


; Set the Bit 5 in the status register which selects Bank 1 in the RAM

movwf TRISB
; Copy the W register content into TRISB register
; [ makes PORTB output]

bcf STATUS,5
; Clear the Bit 5 in the status register which selects Bank 0 in the RAM

again


; This is a label for the repeating part of the program

movlw 0x80
movwf PORTB

; Copies 0x80 [binary 1000 0000 ] in the W register
; Copy the W register content into PORTB register

call delay

; This command calls the Delay routine.

movlw 0x00
movwf PORTB

; Copies 0x00 [binary 0000 0000 ] in the W register
; Copy the W register content into PORTB register


goto again

; This label is important to keep the program running forever

delay


; This is the label for the delay routine
; The delay consists of 3 nested loops

movlw 0x01
movwf 0x0e

; Put 0x01 in W register
; And copy it to the memory address 0x0e in RAM

loop3


; Label

movlw 0xfa

movwf 0x0d

; Put 0xfa in W register
; And copy it to the memory address 0x0d in RAM

loop2

; Label

movlw 0xfa
movwf 0x0c

; Put 0xfa in W register
; And copy it to the memory address 0x0c in RAM

loop1


; Label

decfsz 0x0c,1
; Decrease contents of memory address 0x0c by 1 ,
; then skip the next command if the result is zero


goto loop1


; goto the outer loop

decfsz 0x0d,1


; Decrease contents of memory address 0x0d by 1 ,
; then skip the next command if the result is zero

goto loop2

; goto the outer loop

decfsz 0x0e,1

; Decrease contents of memory address 0x0e by 1 ,
; then skip the next command if the result is zero

goto loop3

; goto the outer loop

return
; Retrun from the Delay routine

end

; must be put at the end of the program

;*********************************************************************

This is the end of the program. Now that you understand this basic program of LED flasher, you can understand more complex programs and tricks.






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