Wednesday, December 28, 2011

Hexapod Robot IIII

Six-Legged Autonomous Mobile Robot

This six-legged mobile robot was a research platform I built to
investigate reactive robotic architectures. The work won the
Third Place Grand Award at the Intel International Science and
Engineering Fair. The robot had over 2,000 components, 21 motors,
and 10 processors and was built during my senior year in high school.
The robot is very similar in design to Attila and Hannibal, designed
and built by Colin Angle and Rod Brooks at the MIT AI Lab.
This project was completed in May, 1992.
http://www.cs.berkeley.edu/~prabal/projects/index.html

3D Modelling for beginners : Hexapod Robot



Here is a step by step design guide which will help you from
next time convert your drawings or ideas into 3D models
which are a better representation and also good to look .
For the purpose of explaining the use we have chosen to
build a model of a Hexapod . So if you can use ms paint
you can do this .

LARA



I eventually decided upon a design whereby the 6 legs were
divided into three pairs, with each pair being joined by top and
bottom beams. The legs were sat on ball-bearing thrust races
to reduce friction and allow the robot to turn easier.

Hexapod Robot2


The hexapod robot developed by the Illinois hexapod group is
modeled after the American cockroach, Periplaneta americana.
We selected this insect as a model because of its extraordinary
speed and agility and because the structure and physiology of
this insect are reasonably well known. The body of the robot measures
58 cm by 14 cm by 23 cm length, width, and height. It has an
additional 15 cm ground clearance when standing. The legs,
projecting laterally and to the front, add about 38 cm to the
width and 18 cm to the length. The robot weighs approximately
11 kg, most of the weight being in the valves that control the
pneumatic actuators. The physical dimensions of the robot body
and legs are generally between 12 and 17 times the size of the
comparable dimensions of the cockroach. The robot, however,
is considerably heavier in relation to its size due to the weight
of the valves.
read more "Hexapod Robot IIII"

Monday, December 26, 2011

Schematic Frequency Counter and Pulse Width Measurement System

Frequency Counter and Pulse Width Measurement System, Cum Digital Clock

This post discusses the implementation of frequency counter and pulse width measurement system and digital clock. The purpose of post is to present the hardware and software parts of the project. The main components are: AT89C52 microcontroller, HD44780U LCD Display Panel and MAX232 level converter. The software is written/programmed in Kiel C51.

Table of Contents of the Project based on microcontroller AT89s52

1 Project Description of Frequency Counter and Pulse Width Measurement System, Cum Digital Clock
2 8052 OVERVIEW
2.1 Special Function Registers (SFR) of 8051 family microcontrollers
2.2 ALU of 8051 family microcontrollers
2.3 Accumulator of 8051 family microcontrollers
2.4 Program Status Word (PSW) of 8051 family microcontrollers
2.5 Stack Pointer (SP) of 8051 family microcontrollers
2.6 Data Pointer (DPTR) of 8051 family microcontrollers
2.7 Timer/Counters of 8051 family microcontrollers
2.8 UART in 8051 family microcontrollers
2.9 I/O Ports of 8051 family microcontrollers
2.10 Program Counter (Pc) of 8051 family microcontrollers
2.11 Scratchpad Registers (Ram) of 8051 family microcontrollers
2.12 Register Banks of 8051 family microcontrollers
2.13 Address/Data Bus of 8051 family microcontrollers
2.14 Internal Ram Organization of 8051 family microcontrollers
2.15 Interrupts of 8051 family microcontrollers
3 LCD Overview and its uses with 8051 family microcontrollers
3.1 Function Description of liquid crystal display
3.1.1 Registers of liquid crystal display
3.1.2 Busy Flag (BF) of liquid crystal display
3.1.3 Address Counter (AC) of liquid crystal display
3.1.4 Initializing by Internal Reset Circuit
3.2 Pin assignment of liquid crystal display
3.3 Instruction set of liquid crystal display
3.4 LCD addressing values
4 MAX 232 and its interfacing with microcontroller 8051
5 Circuit Diagram of Frequency Counter and Pulse Width Measurement System Project
6 SOFTWARE of Frequency Counter and Pulse Width Measurement System project

What will you do in this project:-
  1. students will learn the Introduction of microcontroller 8052
  2. How do frequency counters work
  3. Functionality of pulse width modulation and PWM measurements with microcontroller 8052
  4. Implementation of digital clock with microcontroller 8051
  5. how do different task are performed within a microcontroller
  6. Time trigger task performance
  7. Interfacing of LCD with microcontroller
  8. Serial communication RS232 between PC and microcontroller 8052
  9. Code writting in Keil C51 for Microcontroller 8051 family

 . Next Page

Tags:-frequency meter with 8051,microcontroller based frequency meter, read precise frequency with microcontroller, how to develop a frequency meter, atmel 89c51 microcontroller, high frequency meter, measure frequency using microcontroller
read more "Schematic Frequency Counter and Pulse Width Measurement System"

Hexapod Robot III

MHEX II Walking Hexapod

Mhex II is an omnidirectional hexapod (6 legged) walking robot.
Each leg has 3 motors which allow the feet to be placed
anywhere in 3D space within mechanical limits. Unlike my first
hexapod robot (MHEX), this configuration allows the robot
to walk in any direction keeping it's feet fixed at a point on
ground without slipping.
http://mikael.geekland.org/

An 18-DOF hexapod robot developed at the University of Florence



An 18-DOF hexapod robot was complete designed and
developed at the University of Florence by Andrea Foschi in
2005. It was later tamed by Marco Natalini and Alessandro
Mambelli using Evidence Srl's FLEX Light board and ERIKA
kernel. The main purpose for adopting FLEX is due
to its low-cost development kit that permits easy addition
of features i.e. Sensors and behaviour. Since then, a number
of students have worked on this hexapod. The future version
would use the FLEX Full board.
http://www.evidence.eu.com/content/view/261/266/

Hexapod - Build Blog



Our design for the first hexapod is simple. It is supposed
to be a prototype for a more complex robot that we will
build this fall. The design includes three servos per leg.
One servo will rotate the leg while the other two perform
the functions of a hip and a knee.



Stiquito is a small, inexpensive hexapod (i.e., six-legged) robot.
Universities, high schools, and hobbyists have used
it since 1992. Stiquito is unique not only because it is so
inexpensive but also because its applications are almost limitless.
The propulsion in these robots is nitinol, an alloy actuator wire
that expands and contracts, roughly emulating the operation
of a muscle. The application of heat causes a crystalline
structure change in the wire. Nitinol contracts when heated
and returns to its original size and shape when cooled.
http://ourworld.compuserve.com/homepages/Stiquito/whatisstiquito.htm
read more "Hexapod Robot III"

Thursday, December 22, 2011

Hexapod Robot II

Robot II

Robot II is a hexapod with three active, revolute degrees of
freedom (DOF) and one spring-loaded, translational DOF per leg.
Each active DOF is powered by a separate 6 Watt DC motor
with an integral transmission. The sensing of joint position is
accomplished by a rotary potentiometer attached to each joint.
Foot forces are monitored by load cells mounted on the tibia
segments. The structure of the body is composed of
lightweight aircraft plywood, balsa and aluminum.

http://biorobots.cwru.edu/Projects/robot2/robot2.htm

The SIL06 Walking Robot


The SILO6 is a hexapod designed as the mobile platform of the DYLEMA project
intended to configure a system for detection and location of antipersonnel land mines.
Walking robots are intrinsically slow machines, and machine speed
is well known to depend theoretically on the number of legs the
machine has. Therefore, a hexapod can achieve higher speed
than a quadruped, and a hexapod achieves its highest speed
when using a wave gait with a duty factor of β = 1/2, that is, using
alternating tripods. Although stability is not optimum when using
alternating tripods, a hexapod configuration has been chosen just
to try to increase the machine’s speed. The walking-robot
development is based on certain subsystems developed for
the
SILO-4 walking robot. The SILO4 is a quadruped robot
developed for basic research activities and educational purposes.
For this reason, this new walking robot is named SILO-6,
referring to its six legs.
http://www.iai.csic.es/users/silo6/SILO6_WalkingRobot.htm

Sprawlita


Sprawlita is a Shape Deposition Manufactured platform with six legs of 2 (actuated) DOF each. Based on the Sprawl 1.0 and Mini-Sprawl prototypes, it is a platform to test ideas about locomotion schemes, leg design and leg arrangement and to build compliant leg structures using SDM. The size is the same scale as Mini-Sprawl, with slightly more mass (270g vs. 250g) and less stiff compliant hip joints with only one (intended) degree of freedom.
http://www-cdr.stanford.edu/biomimetics/

BILL-Ant Series Robots



The Biologically-Inspired Legged Locomotion Ant (BILL-Ant) is an 18-DOF hexapod with six passive DOF feet for force sensing, a 3-DOF neck and actuated mandibles with force sensing pincer plates (28-DOF total). The robot uses force Sensors in the feet and pincers to actively comply with its environment and respond to external pertubations.
http://biorobots.cwru.edu/projects/billant/





read more "Hexapod Robot II"

Wednesday, December 21, 2011

Hexapod Robot I

Mike Smyth's Hexapod Robot


This is my autonomous hexapod robot that I built a few years ago.
It uses 12 R/C servos for actuators. The 6 that raise and lower
the legs are Hobbico CS-72 1/4 scale and the 6 that move the legs
forward and backward are several brands of standard 1/10
scale servos
http://home.ctlnet.com/~robotguy67/hexapod/hexapod.htm


Robot III



a hexapod with kinematics based on studies of the cockroach
Blaberus discoidalis performed in the Ritzmann Lab in the
Biology Department at CWRU. It has a total of 24 degrees of freedom
with five for each front leg, four for the middle legs and three for the rear
legs. The robot is pneumatically actuated using off the shelf cylinders and
blocks of three-way pneumatic valves. Pulse width modulation of the
valves is implemented for variable position control of the cylinders.
The structure of the robot is machined from high grade aluminum alloys.
http://biorobots.cwru.edu/projects/robot3/robot3.htm


Bio-Robotic Choreography





The 6-legged robot will use a pentagraph mechanism where the
movement of the foot is mirrored by the joint at opposite end. The
effect is that the robot is hanging from a virtual pendulum in the sky.
This will help the robot to stay on it's feet. Stationary it will be nearly
5 metres across and measure 2 metres from knee to foot.
The designers are hoping to limit the weight to less than 250 kgs.
http://ahds.ac.uk/performingarts/collections/sci-art/design.htm

Rhex

RHex is a small, power and computationally autonomous hexapod
robot with passively compliant legs. Its basic design incorporates
only one actuator per leg, capable of achieving fast (~2.5m/s)
and robust locomotion over complex outdoor terrain. As a result
of the minimal use of exteroceptive sensing, most of its behaviors
are task-level open loop, driven by an internal clock. These basic
behaviors rely on a human operator for more complicated
tasks such as navigation.
http://www.cs.bilkent.edu.tr/~saranli/research/rhex.html
-
-
read more "Hexapod Robot I"

Tuesday, December 20, 2011

Control I-PD controller and tuning

A design method of multirate I-PD controller based on multirate generalized predictive control law

This paper proposes a new design method of an I-PD controller. The I-PD controller is designed in a multirate system with fast control input and slow output sampling. In order to design PID parameters of the multirate I-PD controller, the multirate I-PD controller is designed based on a multirate generalized predictive control law. Since in the multirate system a control input is updated faster than a single-rate system with slow control input and slow output sampling, the control effect of the proposed multirate I-PD controller is greater than that of a conventional single-rate one. Finally in order to show effectiveness of the proposed method, simulation results are illustrated.

http://cat.inist.fr/?aModele=afficheN&cpsidt=17893327

An Adaptive Controller based on system Identification for plants with
uncertainties using well known Tuning formulas

Abstract

Adaptive control which adequately adjusts controller
gains according to the changes in plants, has become
attractive in recent years .The controller proposed in this
paper is tuned automatically with various tuning formulas
based on the results of frequency domain system
identification for the plant. The controller first estimates
the frequency response of the plant using FFT. The
controller gains are automatically tuned so as to minimize
the error between the open loop frequency response of
the reference model and that of the actual system at a few
frequency points. For the three example processes,
reference models are derived. The frequency responses
of the reference models and that of the actual processes
are obtained. The controller gains are determined by
applying the least squares algorithm .The responses of
the plants are verified in time domain and frequency
domain after tuning the I-PD controller.

Block diagram of an I-PD controller along with process
plant


http://www.icgst.com/acse/Volume6/Issue3/P1110626005.pdf


PI-D and I-PD Control with Dynamic Prefilters
In this lab you will be controlling the one degree of freedom systems you previously modeled using PI-D and I-PD controllers with and without dynamic prefilters.
the I-PD controller we have


http://www.rose-hulman.edu/Class/ee/throne/ECE-320%20Fall%202009/lab7a.pdf

DESIGN OF ROBUST POLE ASSIGNMENT BASED ON
PARETO-OPTIMAL SOLUTIONS

ABSTRACT

In this paper, a new design method for robust pole assignment based on
Pareto-optimal solutions for an uncertain plant is proposed. The proposed design
method is defined as a two-objective optimization problem in which optimization
of the settling time and damping ratio is translated into a pole assignment
problem. The uncertainties of the plant are represented as a polytope
of polynomials, and the design cost is reduced by using the edge theorem.
The genetic algorithm is applied to optimize this problem because of its
multiple search property. In order to demonstrate the effectiveness of the
proposed design method, we applied the proposed design method to a magnetic
levitation system.


I-PD control system


http://www.ajc.org.tw/pages/PAPER/5.2PD/PI-01-22.pdf

Study on the I-PD Position Controller Design for Linear Pulse Motor DrivesABSTRACT
In this paper, a brief discussion on I-PD position controller design for linear pulse motor drive is presented. The proposed method mainly focuses on the robusteness property of the controller, which is very important for this type of system in which the variation of external load affects plant parameters. It is considered in this paper that two types of controller design methods namely; Coefficient Diagram Method (CDM), and arbitrary Pole Assignment Method (PAM) are treated and compared them. It is shown in this paper that for the case of CDM, a stability index values are chosen such that the robust property of the controller is adequately sufficient for light and heavy load operation without excessively exciting the motor. For these stability index values and an equivalent time constant, which determines the speed of responese of the system, the closed loop pole locations are automatically fixed. For the case of PAM, the closed loop pole assignments must be iteratively tried to arrive at an acceptable response.

http://nels.nii.ac.jp/els/110000031056.pdf?id=ART0000357399&type=pdf&lang=en&host=cinii&order_no=&ppv_type=0&lang_sw=&no=1260926777&cp=
read more "Control I-PD controller and tuning"

Saturday, December 17, 2011

Control Video Lecture Industrial Automation and Control - Hydraulic Control and Industrial Hydraulic Circuit

Video Lecture Hydraulic Control Systems - I



Video Lecture Hydraulic Control Systems - II



Video Lecture Industrial Hydraulic Circuit

read more "Control Video Lecture Industrial Automation and Control - Hydraulic Control and Industrial Hydraulic Circuit"

Schematic Code of Humidity Project

#include at89x51.h
#include intrins.h//for _nop_() instructions
#include stdio.h
#include stdlib.h
void init_serial_port(void);//
void init_lcd(void);
void init_timer0(void);
void init_interrupts(void);
void clear_screen(void);
void lcd_start_messeges(void);
void serial_start_messeges(void);//
void waitms(unsigned int );
void clearlcd(void);
void waitUS (unsigned char );
//void putcharlcd(unsigned char);
void putstringlcd(unsigned char *);
void positioncursor(unsigned char);
void write_lcd(unsigned char ) ;
sbit rs_lcd = P3^6; // Register Select LCD, H= Data, L = Instruction code
sbit en_lcd = P3^5; // Enable LCD H->L enable
sbit rw = P2^1;
sbit READ = P3^4; /* Define these according to how you have connected the */
sbit WRITE = P3^3;/* RD, WR, and INTR pins of ADC Connected to 89c51 */
sbit INTR = P3^2;
//*************** THE END of declaration******************************************
/* text messeges */
unsigned char code msg1[]= " MSc Physics \0";
unsigned char code msg2[]= " Microcontroller labPROJECT \0";
unsigned char code msg3[]= " Humidity Measurement \0";
unsigned char code msg4[]= " DIGITAL CLOCK \0";
unsigned char code msg5[]= " MEMMORY MAPPING \0";
unsigned char code msg6[]= " using ADC/DAC \0";
unsigned char code msg7[]= " By \0";
unsigned char code msg8[]= " Group \0";
unsigned char code msg9[]= " of \0";
unsigned char code msg10[]=" Students \0";
unsigned char code msg11[]=" 8051 class \0";
unsigned char code msg12[]=" Exploring the \0";
unsigned char code msg13[]=" New Era \0";
unsigned char code msg14[]=" Please Enter the \0";
unsigned char code msg15[]=" Current Time \0";
unsigned char code msg16[]="10% \0";
unsigned char code msg17[]="20% \0";
unsigned char code msg18[]="30% \0";
unsigned char code msg19[]="40% \0";
unsigned char code msg20[]="50% \0";
unsigned char code msg21[]="60% \0";
unsigned char code msg22[]="70% \0";
unsigned char code msg23[]="80% \0";
unsigned char code msg24[]="90 %\0";
unsigned char code msg25[]="100 %\0";
/* Variable declartion for the clock */
char data hrs_str[2];
char data TIME[6]; // Var array total unit calculation
char data LAMHA=0;
char data SEC;
char data MIN;
char data HOUR;
char data TEMEP=0;
char data TEMEP1=0;
char data temp[2];
char data min_str[3];
unsigned char adVal;
unsigned long volts;
/****************************************/
/* end of text messeges block */
// global variables declarations
/*++++++++++++++++++++++++++++*/
void main (void) { //enable global interrupt
min_str[2] ='\0';
rw = 0 ;
init_serial_port();//
clear_screen();
init_lcd();
serial_start_messeges();//
lcd_start_messeges();
init_timer0();
ES =1;
IT0=1;
READ=1;
WRITE=0;
waitms(150);
READ=0;
WRITE=1;
READ=1;
WRITE=0;
waitms(100);
WRITE=1;
while (1) {}
}
void timer0(void) interrupt 1 { //every 10msec
TR0=0;//stop the timer 0
TH0 = 0xDC;
TL0 = 0x11;
TR0= 1;
LAMHA++;
if(LAMHA>=100)
{ LAMHA=0;
SEC++;
/* dispaly time after every second at lcd */
if(SEC>=59)
{ SEC=0;
MIN++;
if(MIN>=59)
{ MIN=0;
HOUR++;
READ=1;
WRITE=0;
READ=0;
WRITE=1;
READ=1;
WRITE=0;
waitms(200);
WRITE=1;
if(HOUR>=13)
HOUR=1;
}
}
////////////////////////////////////////////////////////////
TIME[0]=(HOUR/10)+0x30;
TIME[1]=(HOUR%10)+0x30;
TIME[2]=(MIN/10)+0x30;
TIME[3]=(MIN%10)+0x30;
TIME[4]=(SEC/10)+0x30;
TIME[5]=(SEC%10)+0x30;
positioncursor(0x40); //2nd line
write_lcd(TIME[0]);
write_lcd(TIME[1]);
write_lcd(':');
write_lcd(TIME[2]);
write_lcd(TIME[3]);
write_lcd(':');
write_lcd(TIME[4]);
write_lcd(TIME[5]);
/* send time at serial port */
//printf("\n Current Time is \n ");
putchar(0x0D);
putchar(TIME[0]);
putchar(TIME[1]);
putchar(':');
putchar(TIME[2]);
putchar(TIME[3]);
putchar(':');
putchar(TIME[4]);
putchar(TIME[5]);
//////////////////////////////////////////////////////////////
} }
// InitIO();
//Define External interrupt
void ext_int0(void) interrupt 0{
// READ = 1;
WRITE = 1;
// INTR = 1;
// while(1) {
//Make a low-to-high transition on the WR input
// while( INTR == 1 ); // wait until the INTR signal makes
//high-to-low transition indicating
//completion of conversion
//Read the voltage value from the port
READ = 0;
waitms(400);
adVal = P0;
puts("\n Current HUMIDITY IS \n");
if(adVal<=0x19) {positioncursor(0x00); //first line putstringlcd(msg16); putchar(0x00); puts(msg16);} if(adVal>0x19 && adVal<=0x32) { positioncursor(0x00); //first line putstringlcd(msg17); putchar(0x00); puts(msg17);} if(adVal>0x32 && adVal<=0x4B) { positioncursor(0x00); //first line putstringlcd(msg18); putchar(0x00); puts(msg18);} if(adVal>0x4B && adVal<=0x64) { positioncursor(0x00); //first line putstringlcd(msg19); putchar(0x00); puts(msg19);} if(adVal>0x64 && adVal<=0x7D) {positioncursor(0x00); //first line putstringlcd(msg20); putchar(0x00); puts(msg20);} if(adVal>0x7D && adVal<=0x96) { positioncursor(0x00); //first line putstringlcd(msg21); putchar(0x00); puts(msg21);} if(adVal>0x96 && adVal<=0xAF) { positioncursor(0x00); //first line putstringlcd(msg22); putchar(0x00); puts(msg22);} if(adVal>0xAF && adVal<=0xC8) { positioncursor(0x00); //first line putstringlcd(msg23); putchar(0x00); puts(msg23);} if(adVal>0xC8 && adVal<=0xE1) { positioncursor(0x00); //first line putstringlcd(msg24); putchar(0x00); puts(msg24);} if(adVal>0xE1 && adVal<=0xFF) { positioncursor(0x00); //first line putstringlcd(msg25); putchar(0x00); puts(msg25);} READ = 1; INTR=1; //Compute the digital value of the volatge read //Print the value of the voltage in decimal form //} } void serial_recieve(void) interrupt 4 { if(RI) { RI= 0; if(SBUF == 's'| SBUF == 'S') { puts("\n Enter Time, hhmmss \n"); hrs_str[0]=getchar(); hrs_str[1]=getchar(); HOUR= (char)atoi(hrs_str); min_str[0]=getchar(); min_str[1]=getchar(); MIN= (char)atoi(min_str); SEC = 0x00; } } } void clearlcd(void){ rs_lcd =0; write_lcd(0x01); rs_lcd =1; } void positioncursor(unsigned char c ){ rs_lcd = 0; write_lcd(0x80 | c); // 1xxx xxxx set address of cursor rs_lcd =1; } void putstringlcd(unsigned char *d){ while(!(*d == '\0')){ write_lcd(*d); d++; }} void write_lcd(unsigned char a) { P1 = a; waitUS(250); waitUS(250); waitUS(250); waitUS(250); en_lcd = 0; waitUS(250); en_lcd = 1; } void waitUS(unsigned char a){ while(--a != 0); /* wait = a * 2 + 5 usec @ 12 MHz*/ } void waitms(unsigned int a) { while (--a !=0) { waitUS(247); //500us delay waitUS(247); waitUS(247); //500us delay waitUS(247); } } void lcd_start_messeges(void) { positioncursor(0x00); //first line putstringlcd(msg1); positioncursor(0x40); //2nd line putstringlcd(msg2); waitms(800); clearlcd(); positioncursor(0x00); //first line putstringlcd(msg3); positioncursor(0x40); //2nd line putstringlcd(msg4); waitms(800); clearlcd(); positioncursor(0x00); //first line putstringlcd(msg5); positioncursor(0x40); //2nd line putstringlcd(msg6); waitms(800); clearlcd(); positioncursor(0x00); //first line putstringlcd(msg7); waitms(800); clearlcd(); positioncursor(0x00); //first line putstringlcd(msg8); positioncursor(0x40); //2nd line putstringlcd(msg9); waitms(800); clearlcd(); positioncursor(0x00); //first line putstringlcd(msg10); positioncursor(0x40); //2nd line putstringlcd(msg11); waitms(800); clearlcd(); positioncursor(0x00); //first line putstringlcd(msg12); positioncursor(0x40); //2nd line putstringlcd(msg13); waitms(800); clearlcd(); positioncursor(0x00); //first line putstringlcd(msg14); positioncursor(0x40); //2nd line putstringlcd(msg15); waitms(800); clearlcd(); } void init_serial_port(void) { SCON = 0x52; //SCON: mode 1, 8-bit UART, enable rcvr TMOD |= 0x20; // timer 1 autoreload mode */ TH1 = -12; // TH1: (smod disable ) // -13 reload value for 2400 baud @ 11.0592 MHz TR1 = 1; //TR1: timer 1 run TI = 1; //TI: set TI to send first char of UART } void init_timer0(void) { TMOD &=~0x0F; //clear timer0 mode bits TMOD |= 0x01; //put time0 in 16 bit TH0 = 0xDC; TL0 = 0x11; T0 =0; // set low periority for timer0 ET0 =1; //enable timer 0 interrupt TR0 =1; EA = 1; EX0=1; } void init_interrupts(void) { IE = 0x93; // enable globle , serial and timer0 interrupt IP |= 0x01; // high priority for serial interrupt IT0=1;//TCON |= 0x01; // low edge triggered interrupts } void init_lcd(void){ rs_lcd = 0 ; //for cmd waitms(500); write_lcd(0x38); //Function Set 0011 1000 waitms(100); write_lcd(0x38); //Function Set 0011 1000 waitms(100); write_lcd(0x38); //Function Set 0011 1000 waitms(100); write_lcd(0x0C); //display off/ON No Cursor No Blinking at cursor waitms(100); write_lcd(0x01); //clear Display waitms(100); write_lcd(0x06); //Entry Mode Set rs_lcd = 1 ; // for data } void serial_start_messeges(void) { puts ("this is serial"); puts (msg2); puts (msg3); puts (msg4); puts (msg5); puts (msg6); puts (msg7); puts (msg8); puts (msg9); puts (msg10); puts (msg11); puts (msg12); puts (msg13); puts (msg14); puts (msg15); } void clear_screen(void){ unsigned char i=50; while (--i >=1)
putchar(0x0A);
putchar(0x0D);
}
This is code of the microcontroller project.
 BACK to Content Page .

Tags:- 8051/AT89S52 based SMOKE DETECTOR and FIRE ALARM SYSTEM Embedded Instrumentation Monolithic Thermocouple Amplifiers AD594 AND AD595 humidity measurement Free 8051 microcontroller resources, PAULMON - Easy To Use Monitor Program, AS31 Assembler, Development Circuit Board Design, Code Library humidity chart humidity control dew point
humidity calculator PIC-Microcontroller Code Samples humidity sensor 8051 pwm code : 8051 Microcontroller Projects AVR PIC Projects absolute humidity precipitation Microcontroller Based Digital code Lock (AT89C2051) vaisala humidity transmitter 8051 Microprocessor Example Program minco humidity transmitter Download Example Programs for C Compiler for 8051 humidity sensor 8051 Programs examples & tutorial industrial humidity meter C/C++ Compiler 8051 - IAR Embedded Workbench for 8051 humidity measuring meter pascal compiler 8051 use humidity meter Commercial 8051 Compiler - Schematic drafting, printed circuit checking humidity humidity meter price Interfacing Humidity Sensor with 8051 Microcontroller. This AT89C51 based Humidity Detector Project described with circuit diagram,Project: Temperature and Humidity Data Logger Project
read more "Schematic Code of Humidity Project"

Schematic circuit diagram of the microcontroller project for humidity and clocking

This is circuit diagram of the microcontroller project for humidity and clocking.

circuit diagram of the microcontroller project for humidity and clocking

Parts List:-
Microcontroller :- AT89s51 or simple AT89c51
Analog to Digital converter:-
ADC0804
Digital to Analog converter:-
DAC0800
Opertaional amplifiers:-
OP07 or LM471, or LM358 or LM1458
Power supplies:-
dual power supplies well regulated for the operational amplifiers +15v,-15v, and one stable regulated power supply for digital circuit based on LM7805
Display:-
LCD 2line and 16 characters display for user read out the values of the parameters
Communication:-
RS-232 serial communication with PC and PC to microcontroller two way communication
PPI:-\
82C55 PROGRAMMABLE PERIPHERAL INTERFACE
All these componets are linked together in a specific manner to have a good project.
 BACK to Content Page


. Next Page


.   Previous Page
Tags:-
Product data 89C51/89C52/89C54/89C58 80C51 8-bit microcontroller family step-by-step utilization and the big world of Atmel's 8-bit with pin counts from 8 up to 100 pins.A/D Channels Brown Out Detector In System Prog
File Format: PDF/Adobe Acrobat
tile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C4051 is a powerful .... The nominal brown-out detection threshold is 2.1V ± 10%
bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a powerful ..... In such cases an external Brown-out Reset circuit connected to the RST pin at89c51 datasheet,at89s51,at89c51 programmer,pin configuration at89c51,at89c2051 datasheet,at89c4051,ic at89c2051,at89c2051 programmer,at89c2051 microcontroller,at89c2051 24pi,at89c2051 circuits,at89c2051 application,adc0804 datasheet,adc0808,adc0804 pdf,adc0804lcn,lm35,dac0800,dac0808,adc0809,dac0800,dac0802,dac0800 mdc
dac0800 application,dac0800lcn,next generation op07,op07 precision operational amplifier,dual op07,pmi op07
read more "Schematic circuit diagram of the microcontroller project for humidity and clocking"

Schematic 82C55 PROGRAMMABLE PERIPHERAL INTERFACE

Functional Description

Data Bus Buffer

This three-state bi-directional 8-bit buffer is used to interface the 82C55A to the system data bus. Data is transmitted or received by the buffer upon execution of input or output instructions by the CPU. Control words and status information are also transferred through the data bus buffer.

Read/Write and Control Logic
The function of this block is to manage all of the internal and external transfers of both Data and Control or Status words.It accepts inputs from the CPU Address and Control busses and in turn, issues commands to both of the Control Groups.(CS) Chip Select. A “low” on this input pin enables the communcation between the 82C55A and the CPU.

(RD) Read. A “low” on this input pin enables 82C55A to send the data or status information to the CPU on the data bus. In essence, it allows the CPU to “read from” the 82C55A.

(WR) Write. A “low” on this input pin enables the CPU to write data or control words into the 82C55A.

A0 and A1) Port Select 0 and Port Select 1. These input signals, in conjunction with the RD and WR inputs, controlthe selection of one of the three ports or the control word register. They are normally connected to the least significant bits of the address bus (A0 and A1).
82C55 PROGRAMMABLE PERIPHERAL INTERFACE

(RESET) Reset. A “high” on this input initializes the control register to 9Bh and all ports (A, B, C) are set to the input mode. “Bus hold” devices internal to the 82C55A will hold the I/O port inputs to a logic “1” state with a maximum hold current of 400uA.

Group A and Group B Controls

The functional configuration of each port is programmed by the systems software. In essence, the CPU “outputs” a control word to the 82C55A. The control word contains information such as “mode”, “bit set”, “bit reset”, etc., that initializes the functional configuration of the 82C55A. Each of the Control blocks (Group A and Group B) accepts “commands” from the Read/Write Control logic, receives “control words” from the internal data bus and issues the proper commands to its associated ports. Control Group A - Port A and Port C upper (C7 - C4) Control Group B - Port B and Port C lower (C3 - C0) The control word register can be both written and read as shown in the “Basic Operation” table. Figure 4 shows the control word format for both Read and Write operations. When the control word is read, bit D7 will always be a logic“1”, as this implies control word mode information.
Mode Selection

There are three basic modes of operation than can be selected by the system software:
Mode 0 - Basic Input/Output
Mode 1 - Strobed Input/Output
Mode 2 - Bi-directional Bus
When the reset input goes “high”, all ports will be set to the input mode with all 24 port lines held at a logic “one” level by internal bus hold devices. After the reset is removed, the 82C55A can remain in the input mode with no additional initialization required. This eliminates the need to pullup or pulldown resistors in all-CMOS designs. The control word register will contain 9Bh. During the execution of the system program, any of the other modes may be selected using a single output instruction. This allows a single 82C55A to service a variety of peripheral devices with a simple software maintenance routine. Any port programmed as an output port is initialized to all zeros when the control word is written.
Single Bit Set/Reset Feature

Any of the eight bits of Port C can be Set or Reset using a single Output instruction. This feature reduces software requirements in control-based applications. When Port C is being used as status/control for Port A or B, these bits can be set or reset by using the Bit Set/Reset operation just as if they were output ports.


This is 82C55 PROGRAMMABLE PERIPHERAL INTERFACE.

 BACK to Content Page


. Next Page


 .   Previous Page
read more "Schematic 82C55 PROGRAMMABLE PERIPHERAL INTERFACE"

Friday, December 16, 2011

Schematic GPS Auditory Navigation

This project goal is to build a navigator that allows a user to navigate to a predefined location through the use of auditory guidance. The project is equipped with GPS, digital compass, and MCU ATmega32 to generate sound based on the direction that the user must turn in order to face the correct direction. One example implementation of this project is a self guided tours navigator.

audio navigation self guide

How does it work?
The module uses GPS and a digital compass to determine at what angle the user hears the sound pulses. On initial start-up the user selects from a number of predefined locations through the use of an LCD screen. Once the GPS has a lock, the module determines the bearing (angle from true North) that the user must travel to get to the destination. This angle is compared with the compass output and a sound is made based on which direction the user must turn to face the final location. The sound consists of short pulses that are delayed between the right and left side and modulated in amplitude to give the effect of direction.

read more "Schematic GPS Auditory Navigation"

Thursday, December 15, 2011

Control Video Lecture Industrial Automation and Control - CNC ,Contour generation , Motion Control and Flow Control Valves

Video Lecture Introduction To CNC Machines



Video Lecture Contour generation and Motion Control



Video Lecture Flow Control Valves

read more "Control Video Lecture Industrial Automation and Control - CNC ,Contour generation , Motion Control and Flow Control Valves"

Schematic DAC0800 introduction

The DAC0800 series are monolithic 8-bit high-speed current-output digital-to-analog converters (DAC) featuring typical settling times of 100 ns. The DAC0800 series also features high compliance complementary current outputs to allow differential output voltages of 20 Vp-p with simple resistor loads as shown in Figure below
DAC0800 Connection Diagrams


Features of DAC0800

• Fast settling output current: 100 ns
• Full scale error: ±1 LSB
• Nonlinearity over temperature: ±0.1%
• Full scale current drift: ±10 ppm/°C
• High output compliance: −10V to +18V
• Complementary current outputs
• Interface directly with TTL, CMOS, PMOS and others
• 2 quadrant wide range multiplying capability
• Wide power supply range: ±4.5V to ±18V
• Low power consumption: 33 mW at ±5V
• Low cost

analog voltage get amplified and isolated from the controller circuit hence the Opamp circuit is used to provide the compatibility with the alarming device. In our circuit we have used a speaker as an alarming device which is operable on 5V.
We have used the DAC to convert the digital data coming from the micro-controller to an analog alarming device, this is done by using an opamp 741 at the output of DAC so that the
analog voltage get amplified and isolated from the controller circuit hence the Opamp circuit is used to provide the compatibility with the alarming device. In our circuit we have used a speaker as an alarming device which is operable on 5V.  

The DAC0800 provides high speed digital to analog conversion. When very low conversion rates can be used, another method of digital to analog conversion may suffice. Consider a square wave which is input to a low pass filter, whose cutoff frequency is far below the repetition rate of the square wave. From Fourier analysis, only the average value of the square wave should pass through the filter. By varying the duty cycle for the square wave, the average value o f the wave can be changed. Therefore, a low pass filter and the output compare functions can be used together to form a simple D/A converter for slowly varying signals.
Write a program that uses the low pass filter in Figure 2 as a D/A converter. Accept a voltage, between 0V and 5.0V, and use a 10KHz wave with variable duty cycle to produce the proper output voltage. The output compare functions should be used to generate the square wave. Measure Rref with an ohmmeter. Connect the circuit in Figure 1. Measure the voltage dropped across Vref and calculate IFS. Run the program for several voltages and analyze the results.
This is DAC0800 introduction .

BACK to Content Page


 . Next Page


 .   Previous Page
read more "Schematic DAC0800 introduction"

Schematic Interfacing the ADC0804 to the AT89C51

The analog voltage is applied to pin 6 and the result is available at pins 11 through 18. We have connected pin 1 (Chip Select) to ground so that the chip is always enabled. Connected pin 7 (Vin - ) to ground.
The ADC0804 includes an internal oscillator, which requires an external capacitor and resistor to operate. Connect the 150-pF capacitor from pin 4 to ground and the 10k ohm resistor from pin 4 to pin 19.
adc0804 pin connection and interfacing with microcontroller

Also for power,
Connect pin 20 to 5 volts.
Connect Pin 8 to ground.
Connect pin 10 to ground
The AT89C51 is a general purpose microcontroller.
# To control the ADC0804, we will use 3 lines from the 89C51.
Connect pin 2 (Read) from the ADC0804 to P3.5 of the 89C51
Connect pin 3 (Write) to P3.3
Connect pin 5 (Interrupt) to P3.2.
The 8 bit Output Data from the ADC0804 will be connected to Port 1 of the 89C51.
Connect pin 18 (D0) of the ADC0804 to pin 1 of the 89C51 (P1.0).
Connect pin 17 (D1) to pin 2(P1.1).
Connect pin 16 (D2) to pin 3 (P1.2).
Connect pin 15 (D3) to pin 4 (P1.3).
Connect pin 14 (D4) to pin 5 (P1.4).
Connect pin 13 (D5) to pin 6 (P1.5).
Connect pin 12 (D6) to pin 7 (P1.6).
Connect pin 11 (D7) to pin 8 (P1.7).

#To power the 89C51,
Connect pin 40 of the 89C51 to 5 volts.
Connect pin 20 of the 89C51 to ground.
#For the 89C51oscillator,
Connect the 11.259 MHz Crystal from pin 18 of the 89C51 to pin 19 of the 89C51.
Connect one 33 pF capacitor from pin 18 of the 89C51 to ground.
Connect the other 33 pF capacitor from pin 19 of the 89C51 to ground.
#For the 89C51 reset circuit,
Connect the 8.2k ohm resistor from pin 9 of the 89C51 to ground.
Connect the 10 uF capacitor from pin 9 of the 89C51 to 5 volts.
CONVERSION STAGES:
The 89C51controls the analog to digital conversion process. The conversion process has several stages.
Stage 1) To trigger a new conversion, we must make pin 3 (Write) low and then return it to the high state. The conversion process starts when Write goes high (rising edge triggered).
Stage 2) When the conversion process is complete, pin 5 (Interrupt) will go low.
Stage 3) When we see pin 5 (Interrupt) go low, we must make pin 2 (Read) low to load the new value into the outputs D0 - D7.
Stage 4) Next we read the values into the 2051 Port 1.
Stage 5) Finally, we return pin 2 (Read) to the high state. The next conversion can be started immediately.
Mixed Signal Testing requires knowledge of analog circuits, digital signal processing, sampling theory and mathematics, in addition to the traditional digital test issues. This tutorial cuts through the confusion and gives the attendee a jump-start in making the transition to mixed signal test engineering. Unlike many “theory based” tutorials this course is designed for the “hands on” engineer who needs to understand the practical issues of A/D testing.
· How ADC performance is validated
· ATE architectures for mixed signal testing
· How ADCs work, including five different device architectures
· ADC static linearity measurement specifications and specsmanship
· Three different measurement techniques for linearity
· ENOBs and Histograms
· ADC Dynamic Specifications
· Frequency Domain analysis of dynamic ADC performance
· AC timing parameters
· Test Engineering Tricks and Techniques for solving difficult challenges
Conversion Basics –
Digital vs. Analog Testing
Mixed Signal Testing
Converter Test Overview
Verifying Converter Performance
Static Testing
Dynamic Testing
ATE Architectures for ADC Test –
Traditional Linear ATE Architectures
ATE Mixed Signal Architectures
Waveform Generator Overview
Waveform Generator Memory and Conversion
Waveform Generator Conditioning and Filtering
Waveform Digitizer Overview
Waveform Digitizer Conditioning and Filtering
Waveform Digitizer Capturing, Converting, and Storing
Digital Signal Capture
Digital Signal Processor
DSP Library
 BACK to Content Page


 . Next Page


.   Previous Page
read more "Schematic Interfacing the ADC0804 to the AT89C51"

Schematic literature on ADC

ADC


The easiest way to do analog to digital conversion is to use an IC such as the ADC0804 that does the work for us.
ADC0804 pin configuration and interfacing

Analog to digital conversion is the process by which an analog quantity is converted to digital form. It is necessary when measured quantities must be in digital form for processing in a computer or for display or storage. Several types of ADC’S are available.The most widely used method of A/D conversion is successive approximation. It has much faster conversion time than the other methods. It also has a fixed conversion time that is the same for any value of the analog input.
To be able to implement analog to digital conversion using the ADC0804LCN 8-bit A/D converter. We have designed a circuit and program the chip so that when an analog signal is given as input, the equivalent digital voltage is displayed on an LCD display. Thus, in effect, our circuit should function like a simple voltmeter.
The ability to convert analog signals to digital and vice-versa is very important in signal processing. The objective of an A/D converter is to determine the output digital word corresponding to an analog input signal.

The A/D converter operates on the successive approximation principle. Analog switches are closed sequentially by successive-approximation logic until the analog differential input voltage [Vin(+) - Vin(-)] matches a voltage derived from a tapped resistor string across the reference voltage.
The normal operation proceeds as follows. On the high-to-low transition of the WR input, the internal SAR latches and the shift-register stages are reset, and the INTR output will be set high. As long as the CS input and WR input remain low, the A/D will remain in a reset state. Conversion will start from 1 to 8 clock periods after at least one of these inputs makes a low-to-high transition. After the requisite number of clock pulses to complete the conversion, the INTR pin will make a high-to-low transition. This can be used to interrupt a processor, or otherwise signal the availability of a new conversion. A RD operation (with CS low) will clear the INTR line high again. The device may be operated in the free-running mode by connecting INTR to the WR input with CS=0.

Since this is an 8-bit A/D converter, a voltage from 0-5V. O will be represented as 0000 0000 (0 in decimal) and 5V is represented as 1111 1111 (256 in decimal). To convert a value X volt to decimal, use the following formula:


X * 5.0
-------
256

To get a better resolution, and display the value as a floating-point number, we can multiply the numerator by a factor of 100, 1000 etc. and then print the voltage accordingly.




 BACK to Content Page


 . Next Page


.   Previous Page
read more "Schematic literature on ADC"

Schematic Testing Circuit of humidity sensing project

Testing Circuit

To test our circuit, connect various voltages to pin 6 of the ADC0804. we have connected a jumper from pin 6 to 5 volts, the voltage on the sample program should say 5 volts. Remove the jumper. Try connecting a 2.2k resistor from pin 6 to ground and another 2.2k resistor from pin 6 to 5 volts. The result should be around 2.5 volts. Remove the resistors.
Try playing with the 220 uF capacitor and the 15k Ohm resistor. Connect the negative leg of the capacitor to ground and the positive leg to pin 6 of the ADC0804. Connect the resistor from pin 6 to 5 volts. The voltage should rise quickly and then slower as it approaches 5 volts. Now remove the resistor. The voltage should stay at the same voltage and slowly decay as the capacitor loses its charge. Connect the resistor from pin 6 to ground to quickly discharge the capacitor.
designed to address the real life issues associated with
testing A/D converters. The skills and knowledge acquired in this course extend well beyond A/D
converters to provide a functional model for testing a variety of mixed signal circuits.
Today many Test, Product, and Applications Engineers are familiar with digital circuits but lack
experience with mixed signal devices and modern mixed signal ATE equipment.
Data Converters
• Practical aspects of converter testing
• Signal source
• Filters for signal source harmonic distortion attenuation
• Clock generator requirements
• Evaluation board considerations
• D/A converter design
Clock Generator
• Let us check if for the clock a "valuepriced" signal generator will suffice...
• No! The clock signal controls sampling instants – which we assumed to be precisely equi-distant in time (period T)
• Variability in T causes errors
– "Aperture Uncertainty" or "Aperture Jitter"
• How much Jitter can we tolerate?
Once we have a good enough generator, other circuit and test setup related issues may determine jitter, but...
• Usually, clock jitter in the single-digit pico-second range can be prevented by appropriate design techniques
– Separate supplies
– Separate analog and digital clocks
– Short inverter chains between clock source and destination
• Few, if any, other analog-to-digital conversion non-idealities have the same symptoms as sampling jitter:
– RMS noise proportional to input frequency
– RMS noise proportional to input amplitude
àIn cases where clock jitter limits the dynamic range, it’s easy to tell, but may be difficult to fix...
Evaluation Board
• Planning begins with converter pin-out
– Example of poor pin-outà clock pin right next to a digital output...
• Not "Black Magic", but weeks of design time and studying
• Key aspects
– Supply/ground routing, bypass capacitors
– Coupling between signals
• Good idea to look at ADC vendor datasheets for example layouts/schematics/application
notes
How to Get the Bits Off Chip?
• "Full swing" CMOS signaling works well for
fCLK<100MHz- For higher frequencies: – Uncontrolled characteristic impedance – High swingà higher level of spurious coupling to other signals – Low power efficiency • But we want to build faster ADCs... • Alternative to CMOS: LVDS – Low Voltage Differential Signaling • LVDS vs. CMOS: – Higher speed, more power efficient at high speed – Two pins/bit! State-of-the-art converters almost always yield surprises in silicon – If models anticipate everything, the application probably isn’t state-of-the-art • Analog designers and mixed-signal architects at times invent new circuits while measuring in the lab • How do we debug converters? – Start with a simple time domain test. Does the captured digital waveform look like a sine wave? – Begin your DFT/INL signature analysis by scaling down sampling frequencies and signal input frequencies together – If you can’t explain performance with essentially infinite settling times, don’t add dynamic errors to the mix. Typical problems come from nonidealities never built into your "model" – E.g. half-circuit models for fully-differential circuits inherently can’t explain some types of differential-symmetry errors • You can’t afford to rediscover old nonidealities in new silicon – Talking to veterans early in the modeling phase can be important Design teams usually track down and fix single-cause problems quickly • Problems due to circuit interactions are much more difficult to debug, try to avoid by good design/layout • Interaction examples: – Digital activity-dependent clock jitter • S/(N+D) degradation only happens when large amplitude, high frequency analog inputs coincide with the offending digital activity – Distortion cancellation • Nonlinear phenomena don’t obey superposition Never assume all of your data is good – One bad data set can “rule out” the correct explanation, leading you astray forever • "Compare measurements to themselves“ • But, noise is a random variable, and the noise power in 1000 time samples will vary from DFT to DFT • How big an effect is this? DAC architecture has significant impact on DNL • INL is independent of DAC architecture and requires element matching commensurate with overall DAC precision • Results are for uncorrelated random element variations • Systematic errors and correlations are usually also important Ref: Kuboki, S.; Kato, K.; Miyakawa, N.; Matsubara, K. Nonlinearity analysis of resistor string A/D converters. IEEE Transactions on Circuits and Systems, vol.CAS-29, (no.6), June 1982. p.383-9. This is Testing Circuit of humidity sensing project.

 BACK to Content Page


 . Next Page


.   Previous Page
read more "Schematic Testing Circuit of humidity sensing project"

Monday, December 12, 2011

Control Interface Keypad to ATmega 8535


Basically keypad is a number of buttons compiled in such a manner so that forms formation of numeral button and some other menus. Many types of keypad that can be use for interface to microcontroller. Keypad needed to interaction with system, for example we make setting with set-point would a control feedback at the time of program still run.



Actually every programmer has different way interaction to with system. Even for keypad in hardware every programmer can differ in. This thing is more because of different requirement.

Keypad 4×4 very often applied by programmer. Besides its the hardware easy, software nor hard. Basically keypad 4×4 is 16 push-button stringed up in matrix. Interfacing keypad 4×4 with pattern scanning hardly easy to be done. Besides having to has keypad 4×4, we only require a diode as supporter component. Diode applied is 1N4001 attached by series with K1, K2, K3 and K4 with part of Anode.

Compiler program keypad by using in codevision AVR.
#include
// Alphanumeric LCD Module functions
#asm
.equ_lcd_port=0×15
#endasm
#include
//Declare your global variables here
Unsigned char dt, dtkey;
Void detect_key (void);
Void main(void)
{
//Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=On Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0×00;
DDRA=0×00;
// Port B initialization
// Func7=On Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTB=0×00;
DDRB=0×00;
// Port C initialization
// Func7=On Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0×00;
DDRC=0×00;
// Port D initialization
// Func7=On Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=P State6=P State5=P State4=P State3=P State2=P State1=P State0=P
PORTD=0×00;
DDRD=0×00;
// Timer/Counter 0 Initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0×00;
TCNT0=0×00;
OCR0=0×00;
// Timer/Counter 1 Initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
TCCR1A=0×00;
TCCR1B=0×00;
TCNT1H=0×00;
TCNT1L=0×00;
ICR1H=0×00;
ICR1L=0×00;
OCR1AH=0×00;
OCR1AL=0×00;
OCR1BH=0×00;
OCR1BL=0×00;
// Timer/Counter 2 Initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0×00;
TCCR2=0×00;
TCNT2=0×00;
OCR2=0×00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0×00;
MCUCSR=0×00;
// Timer (s) / Counter (s) Interrupt (s) initialization
TIMSK=0×00;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0×80;
SFIOR=0×00;
LCD module initialization
lcd_init(16);
lcd_gotoxy(0,0);
lcd_puts(“Keypad to LCD…”);
lcd_gotoxy(0,1);
lcd_putsf(“Pad”);
while (1)
// Place your code here
Detect_key();
lcd_gotoxy(7,1);
sprint(buf, “%x hex”, dtkey);
lcd_puts(buf);
delay_ms(5);
};
}
Void detect_key(void) {
PORTD.4=0
Dt=(~PIND & 0×0F);
Switch (dt) {
Case1: dtkey=0×1;
Break;
Case2: dtkey=0×4;
Break;
Case4: dtkey=0×7;
Break;
Case8: dtkey=0xa;
Break;
};
PORTD.5=1; PORTD6=0;
Dt=(~PIND & 0×0F);
Switch (dt) {
Case 1: dtkey=0×3;
Break;
Case 2: dtkey=0×6;
Break;
Case 4: dtkey=0×9;
Break;
Case 8: dtkey=0xb;
Break;
};
PORTD.6=1; PORTD.7=0;
Dt=(~PIND & 0×0F);
Switch (dt) {
Case1: dtkey=0xc;
Break;
Case2: dtkey=0xd;
Break;
Case4: dtkey=0xe;
Break;
Case8: dtkey=0xf;
Break;
};
PORTD.7=1;
}


read more "Control Interface Keypad to ATmega 8535"