Monday, July 26, 2010
Access Control System
Automatic Traffic Control System
The intelligent and cooperative set-up of actuation and its linkage to the central control system is vital for avoiding traffic jams and accidents. Moreover, environmental costs (eg pollution) can be decreased.
The design of the traffic control system can be evaluated in two steps – synthesis and analysis. Several models and multiple control strategies exist, and engineers must decide between them using a priori knowledge of the real system. Previously collected information can help to choose the appropriate model, parameters, measurement and control methodologies to create the optimal solution.
Wednesday, July 21, 2010
Difference b/w microprocessor and microcontroller
Microcontroller on the other hand is designed to operate with minimal external circuitry using a control program in ROM. The instruction set is simpler in a microcontroller compared to that in microprocessor as instruction are needed to move code and data between internal memory and ALU.
Sunday, July 18, 2010
LCD Interface
Schematic

Circuit Description
Above is the quite simple schematic. The LCD panel's Enable and Register Select is connected to the Control Port. The Control Port is an open collector / open drain output. While most Parallel Ports have internal pull-up resistors, there are a few which don't. Therefore by incorporating the two 10K external pull up resistors, the circuit is more portable for a wider range of computers, some of which may have no internal pull up resistors.
We make no effort to place the Data bus into reverse direction. Therefore we hard wire the R/W line of the LCD panel, into write mode. This will cause no bus conflicts on the data lines. As a result we cannot read back the LCD's internal Busy Flag which tells us if the LCD has accepted and finished processing the last instruction. This problem is overcome by inserting known delays into our program.
The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy here. As with all the examples, I've left the power supply out. You can use a bench power supply set to 5v or use a onboard +5 regulator. Remember a few de-coupling capacitors, especially if you have trouble with the circuit working properly.
The 2 line x 16 character LCD modules are available from a wide range of manufacturers and should all be compatible with the HD44780. The one I used to test this circuit was a Powertip PC-1602F and an old Philips LTN211F-10 which was extracted from a Poker Machine! The diagram to the right, shows the pin numbers for these devices. When viewed from the front, the left pin is pin 14 and the right pin is pin 1.
Programming - Source Code
/* LCD Module Software */
/* 17th May 1997 */
/* Copyright 1997 Craig Peacock */
/* WWW - http://www.senet.com.au/~cpeacock */
/* Email - cpeacock@senet.com.au */
/* */
/* Register Select must be connected to Select Printer (PIN 17) */
/* Enable must be connected to Strobe (PIN1) */
/* DATA 0:7 Connected to DATA 0:7 */
#include
#include
#define PORTADDRESS 0x378 /* Enter Your Port Address Here */
#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2
void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */
outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port - Make sure Forward Direction */
outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer (Register Select) */
for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT */
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe (Enable)*/
delay(20); /* Larger Delay for INIT */
}
outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer (Register Select) */
len = strlen(string);
for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
Above is the source code to get this example running. It's been written for Borland C, so if you are using a Microsoft compiler, then you will have to change the outportb() function to outp() and inportb() to inp().
The LCD panel requires a few instructions to be sent, to order to turn on the display and initialise it. This is what the first for loop does. These instructions must be sent to the LCD's Instruction Register which is controlled by the Register Select (Pin 4). When pin 4 is low the instruction register is selected, thus when high the data register must be selected. We connect this to the Parallel Port's Select Printer line which happens to be hardware inverted. Therefore if we write a '1' to bit 3 of the Control Register the Select Printer line goes low.
We want to first send instructions to the LCD module. Therefore the Register Select line must be low. As it is hardware inverted, we will want to set bit 3 of the Control Register to '1'. However we don't want to upset any other bits on the Control Port. We achieve this by reading the Control Port and OR'ing 0x80 to it. e.g. outportb(CONTROL, inportb(CONTROL) | 0x08); This will only set bit 3.
After we place a data byte on the data lines, we must then signal to the LCD module to read the data. This is done using the Enable line. Data is clocked into the LCD module on the high to low transition. The Strobe is hardware inverted, thus by setting bit 0 of the Control Register we get a high to low transition on the Strobe line. We then wait for a delay, and return the line to a high state ready for the next byte.
After we initialize the LCD Module, we want to send text to it. Characters are sent to the LCD's Data Port, thus we want to clear bit 3. Once again we must only change the one bit, thus we use outportb(CONTROL, inportb(CONTROL) & 0xF7);. Then we set up another for loop to read a byte from the string and send it to the LCD panel. This is repeated for the length of the string.
The delays should be suitable for most machines. If the LCD panel is not initializing properly, you can try increasing the delays. Likewise if the panel is skipping characters, e.g. Tst ,2. On the other hand, If the LCD module is repeating characters e.g. TTTeessttiinngg then you may have a faulting Enable connection. Check your Enable to Strobe connection.
Thursday, July 15, 2010
Automated car parking system
Design
A display is provided at the ground floor which is a counter that displays number of cars in each floor. It informs whether the floor is ful or not. Cars can be lifted up and down! Lift is controlled by stepper motor. An indicator with a green and red LED is kept in all the floors to indicate whether the lift is busy or is it ready to take the car up or down. If the red LED glows that means the lift is already engaged and the person has to wait for the green LED to glow. In this project we have provided three floors of a building for car parking. Maximum storage capacity of each floor is given as ten. Storage capacity can be changed according to the requirement.
When the car enters the lift, the LDR detects its presence and sends a signal to glow RED LED indicating that the lift is busy. It also sends a signal to motor which makes the motor to rotate. After RED LED glows the lift will take the person and the car up to the floor where the space for parking is available. (For VIP it will be the third floor). When the lift reaches the first floor, the processor compares the filled amount to that of the already fed capacity of that floor, and if it finds that the first floor is fully filled , it goes to the second floor and thus the procedure stops here. As soon as a car is placed in a particular floor, the display counter at the ground floor increments as to indicate the floor capacity has decreased by one. After the lift places the car in a particular floor, it comes back to its normal position and that time, the motor that drives it , also stops. Now processor sends signal to glow GREEN LED indicating that lift is free.
When a person needs to come down from a particular floor to ground floor, he is expected to focus the headlight onto the LDR placed in that floor. Now sensor section sends signal to motor that the lift has to be send back to that particular floor and sends a signal to glow RED LED indicating that the lift is busy. As soon as the lift reaches that particular floor car should come inside the lift, the display counter at the ground floor decrements by one as to indicate the floor capacity has increased by one. Lift comes back to its normal position and that time, the motor that drives it, also stops. Now processor sends signal to glow GREEN LED indicating that lift is free.
If there no parking taking place, the processor carries out the job according to the following priority:-
1. It checks whether any password is entered.
2. It checks whether any car is entered to lift.
3. It checks whether any car headlight is pressed in front of LDR placed in each floor.
It is like a round robin system.
3. Hardware description:
Introduction to 8051 Microcontroller:
The 8051 microcontroller generic part number actually includes a whole family of microcontrollers that have numbers ranging from 8031 to 8751.The block diagram of the 8051 shows all of the features unique to microcontrollers:
1. Internal ROM and RAM
2. I/O ports with programmable pins
3. Timers and counters
4. Serial data communication
The block diagram also shows the usual CPU components program counter, ALU, working registers, and the clock circuits.
The 8051 architecture consists of these specific features:
1. 8 bit CPU with registers A and B
2. 16 bit PC &data pointer (DPTR)
3. 8 bit program status word (PSW)
4. 8 bit stack pointer(SP)
5. Internal ROM or EPROM (8751)of 0(8031)to 4k(8051)
6. Internal RAM of 128 bytes.
7. 4 register banks , each containing 8 registers
8. 80 bits of general purpose data memory
9. 32 input/output pins arranged as four 8 bit ports:P0-P3
10. Two 16 bit timer/counters:T0-T1
11. Two external and three internal interrupt sources
12. Oscillator and clock circuits
A pin out of the 8051 packaged in a 40 pin DIP is shown below.