- In this program you can change delay interval by changing the value 1000 in delay function
#include
Header File attached to Project
void delay(); Initialize delay function
void main()
{
unsigned int i; Initialize i as integer variableTRISB=0; Make Port B as Output
for(i=0;i<=100;i++)
{
PORTA=i; Send value of i at Port B
delay(); Call delay function
}
}
void delay()
{
unsigned int j; Make j integer variable
for(j=0;j<1000;j++); Delay
} - If I need different delay intervals I can make a variable delay function as follow:
void delay(unsigned int value)
{
unsigned int j; Make j integer variable
for(j=0;j<value;j++); Delay
}
so I can call this function by writing void delay(1000); - One thing you need to know about Microcontrollers is that Microcontrollers only understand Hex data (binary values). Hex data can be write as 0XAA(where 0X means it’s hex data). So if I want to send Hex Data on Port i can do it as follow:
void main()
{
unsigned int i; Initialize i as integer variable
unsigned char z[] = “0X55,0XAA,0X00”; Hexadecimal data
TRISB=0; Make Port B as Output
for(i=0;i<=2;i++)
{
PORTA=z[i]; Send value of i at Port B
delay(); Call delay function
}
} - Keep trying these type of Program. For practice, try to solve the following problem:
Write a Program which display 0 to 9 counting on 7 segment display.
Problems with Microcontroller Projects? You may face many Problems, but do not worry we are ready to solve your Problems. All you need to do is just leave your Comments. We will assure you that you will find a solution to your project along with future tips. On Request we will Mail you the Codes for Registered Members of this site only, at free service...Follow Me.
PIC(18F) Microcontroller Programming in C (I/O Interfacing)
This is 2nd tutorial on I/O programming of PIC Microcontroller. In this tutorial we are going to learn how to make delay program in PIC Microcontroller using integer values. The following program sends values from zero to 100 on Port B with some delay.
Subscribe to:
Post Comments (Atom)
Recent Comments
Popular Projects
-
Construction of microcontroller based Touchscreen Mobile Phone with Password protected features. Touch Screen GLCD based Digital Devices C...
-
The first project I am posting in this blog is a microcontroller project that communicates with a Siemens M55 mobile phone through the seria...
-
In this project we have used two types of different R.F Module like 433Mhz and 315Mhz interface into Pic16f877a,HT640 for R.F Encoder,HT64...
-
Click below links to get the project: Design with microcontrollers:Final year ECE projects ATmega644 JTAG Debugger Ultrasonic Hapti...
-
Introduction A digital thermometer is a good choice of project for beginners who just stepped in to the world of microcontrollers because it...
-
Automation today has increased the speed of living. This project in which radio frequency is used to automatically control the door locks a...
-
After finishing the serial LCD project , it is time to do some cool projects using PIC12F683. Now we can have a nice LCD display with PIC1...
-
Introduction Tachometer is a device that gives you the information about the rotational speed of any shaft or disc. It usually measures the...
-
The project is a GSM SMS Controller without using any GSM modem. This is using the BTSerial1 module which wirelessly connects to a Bluetoot...
-
Introduction Heart rate measurement indicates the soundness of the human cardiovascular system. This project demonstrates a technique to mea...
No comments:
Post a Comment