Search Projects

Blogroll

Final year degree project for engineers DAC0800 based project circuit diagram and interfacing with pic mirocontroller Final year projects based on microcontrollers on programmable peripheral interface 8255
Microcontroller based different projects abstract and source code
PIC 16f877 microcontroller projects Motion control
PIC16f877 motor controller and other light projects
Tutorials of microcontroller PIC16f877, A step by step easy to use self learning rapidex

Sunday, September 18, 2011

Proton Basic code example for PIC18f452 counter project

PROTON BASIC UP and DOWN Counter PROJECT with RESET USING PIC Microcontroller PIC18f452
Introduction of counter Project:-
This is a simple microcontroller project build for a Up and Down Counter with Reset of counts facility.
In this project PIC18f452 is used for processing and this device is the heart of the project. A 2 line 20 character General purose LCD is used as basic display of the counter.
In this project three push button are used as inputs of counter, but any TTL signal provider ciruit cn be interfaced which uses IR,LDR,phototransistor or optocoupler as input. Because this counter can be used any where, to counts any object passing through a certain location. This counter project counts up to 1000000 counts.
Thus this counter project is suitable where we have to counts any large number of objects.

Parts of the Counter Project:-
This counter project is based on a very few components which are listed as follows:-

1. The heart of the counter project is PIC18f452 (1Nos)
2. Liquid Crystal Display LCD ( 2 line 20 Characters 1Nos)
3. crystal 4MHz (1Nos)
4. Capacitor 20pF (2Nos)
5. Push Buttons (4 Nos)
6. Resistors (10K ohm 4Nos)
7. variable resistor (10K ohm 1 Nos)

A regulated power supply of +5V DC is required to make this project operational.

Circuit Diagram of Counter Project:-
Below is the circuit diagram of counter using PIC18f452 PIC Microcontroller and LCD.

proton basic example project pic18f452 up and down counter with lcd

Main Features of Up and Down Counter:-

The object counter based on PIC Microcontroller have following three basic inputs.
  1. Up button for increment the nuber of counts
  2. Down Button for decrement the number of counts
  3. Reset Button for reset the counted value to zero.
Although in this project push button are being used as the input to counter, but this project accept any TTL input from any circuit which used IR,optocoupler,phototransistor,relays,LDR. Actually this counter is ready to use counting any object, the only thing it requires is TTL pulses for increment , decrement or reset the operation.

Code of counter:-
The code of this project is written in basic language and compiled using proton basic compiler from Crownhill. Proton IDE is a professional and powerful visual Integrated Development Environment (IDE) designed specifically for the Proton Plus compiler.
  The code is written below which uses many built in functions and commands.
'****************************************************************
'* Name : LCD_pic18f452.BAS *
'* Author : [Dr.Rana] *
'* Notice : www.picinf.blogspot.com All Rights Reserved *
'* Date : 9/18/2011 *
'* Version : 1.0 *
'* Notes : Students can use this program for learning *
'* : *
'****************************************************************
Device = 18F452
Xtal=4
All_Digital=true
Output PORTD
TRISB = %11100000 ' only last three pin are inputs
Declare LCD_Interface 4
Declare LCD_Lines 2
Declare LCD_DTPin PORTD.0 ' first four lines Used for 4-line interface.
Declare LCD_ENPin PORTD.4 ' Enable PIN of LCD
Declare LCD_RSPin PORTD.5 ' RS PIN of LCD
Symbol up_counter = PORTB.7
Symbol down_counter = PORTB.6
Symbol reset_counter = PORTB.5
Dim old_b1 As Bit
Dim old_b2 As Bit
Dim old_b3 As Bit
Dim my_counts As Dword
Dim old_counts As Dword
Print At 1 , 5 , "HELLO WORLD"
Print At 2 , 1 , "Counts = "
old_counts = 0
my_counts = 0
old_b1 = 1
old_b2 = 1
old_b3 = 1
PORTB = 255
loop:
If up_counter = 0 And old_b1 = 1 Then GoSub increment_counts
If down_counter = 0 And old_b2 = 1 Then GoSub decrement_counts
If reset_counter = 0 And old_b3 = 1 Then GoSub reset_counts
If old_counts < > my_counts Then GoSub print_counts
old_counts = my_counts
old_b1 = up_counter
old_b2 = down_counter
old_b3 = reset_counter
GoTo loop
End
increment_counts:
Inc my_counts
If my_counts  > = 1000000 Then my_counts = 0
Return
decrement_counts:
If my_counts  >  0 Then Dec my_counts
Return
reset_counts:
my_counts = 0
Return
print_counts:
Print At 2 , 10 , Dec my_counts
Return
proton basic example project pic18f452 up and down counter with lcd

No comments:

Post a Comment

Hi: This is PICINF.blogspot.com comments section. Here you are requested to write your question or problems in detail. Write the question in such a way that, it have all necessary information, sothat i can understand and reply.If you want to send pictures and codes then e-mail me (rghkk@hotmail.com).Thanks.