Hi,
I am new in the embodied world.I am going to develop a simple device which has 4 inputs 1 2 3 4.LED has to be blink while i give the input and also display in LCD which input i give like 1/2/3/4...I kindly request everybody to guide me..Any sort of help is appreciated.
input is given by keypad or PC. if it is keypad then you have to write a program for keypad scan... if it is through PC then you have to write a serial communication program and blink the LED. Please tell how is the input given.... which IDE and compiler are you using????
---------- Post added at 10:49 ---------- Previous post was at 10:46 ----------
Now it toggles continuously.
now you put the condition to check if the input is 1 2 3 or 4 and toggle that particular port pin.......
this program is for serial communication where input is given by PC to controller using UART.
---------- Post added at 11:55 ---------- Previous post was at 11:43 ----------
My requirement is when i press 1/2/3/4 keys in the keyboard,the 4 LEDs connected to port1.1,1.2,1.3,1.4 should on and print the status in LCD also for off condition and in hyperterminal.
please write the keyboard program and check with hardware if it works.... then write a program to compare the inputs and use switch case for that......
keyboard is what type? PC keyboard or other external keypads... 3x3 or any configuration of keypads the code is seperate and PC keyboard will use serial communication program.. which one you use????????
when press 1 in keyboard the led connected with p1.1 pin should on.Then i press 2 in keyboard,first led should off and second led(p1.2)should on..These procedure should continoue for the 4th pin.and everytime led on,it should print on hyperterminal and LCD
---------- Post added at 12:04 ---------- Previous post was at 12:03 ----------
Dear Hareesh,
Please find the attached file
I have written one sample code for your application
considering that you have your LCD routines & UART, Timer initialization routines ready with you.
I haven't put any comment in the code, that is for your home work
Ping me if you want any further help..
yes it is correct... you can see the output in keil simulator window.... go to view in debug mode and open serial window1... then run the program... ( Not step by step) RUN it... come to the serial window and type from keyboard... you should see the letters typed on keyboard...
Actually i want to send the value 1 to sbuf when pres 1 in keyborad and at that time p1.1 pin get on .Then i will press 2 that time p1.1 should off.This is the basic step i want to do.
you need to modify the program that i have given... you have to compare the data and toggle the port pin... few lines of code you need to add...... Its more of a home work .... you are trying to get it done here....
you store the SBUF data in a variable and compare it with the number.. if it is same then do the needed operation............
remove this line a='1'; after while(!RI);
in the next line it is not SBUF = a;........ it is a=SBUF;
dont compare SBUF data... companre the value of a with 1 or 2........
make P1^3 = 1;
or P1^3 = 0;
you can simulate it on keil itself.... see when you type in serial window as one does the port pin in the peripherals pf port 2 change as per your typing of numbers.........