Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

89s52 project...on comparing input and displaying

Status
Not open for further replies.

rohan1234

Newbie level 4
Joined
Mar 19, 2011
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,314
i am trying to program 89s52 atmel microcontroller..
my problem statement is...
i hv 2 design a wagon...which has 8 compartments..
which are initially empty...
so we give in the input(8 bits)..and the processor keeps cheking the inputs everytime we run the program...
and we compare the 8 bits with 11111111(hex ff)..(which means the all the compartments are full)
only if its hex (ff)...the program should give me an output...(the wagon can move wen all the compartments are full)
how do i write a c program for this?...
 

if it has to check for all times then use infinite for loop
take the input in a variable and then compare the variable with ff using if loop
if it satisfies the condition give the instruction to move the wagon

for(;;)
{
if(x==255)
;//here give the instruction that will move the wagon
}

---------- Post added at 12:24 ---------- Previous post was at 12:23 ----------

hope this helps u............
 

thank you so much..
but...sum basic questions...to compare 8 bits..how do i do it?..
each port shud b 1 bit?..or each pin shud b 1 bit?..and which port is d most suitable to b taken as input?..and how?...
 

this simple code to clear the idea

Code:
#include<reg51.h>
#define input P1
void main(void)
{
while(1)

if (input==0xff)
;
// instructions will move the wagom

}

this code by keil
 

how do i ask the user for bit by bit input?....
 

i mean i need 2 ask the user everytime befor fillin one compartment...and after im done with all d compartments...den im supposed 2 compare it with FF...
and can u also suggest a suitable output?...is LED better or BUZZER?..
 

how you ask the user, i mean the method of input data ex (keypad,.... etc) .... please clarify the idea of your project
 

i jus mean i need to enter inputs into 8 pins ONE BY ONE..
and then compare the entire port to 0xFF...
how do i do the bit by bit input?...

---------- Post added at 18:02 ---------- Previous post was at 18:01 ----------

i need the c code for bit by bit input...no idea how to do that..:(
 

use a loop and the statement within should be P0.i as in i specifies the pin no of port. another thing use the port which has no other specific application like port 2 in 8051. and use of buzzer or led depends on the application of project as in where u r gonna use it.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top