This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help making code for People countrer

I am working on a project for school that involves making a counter to count the number of people entering and exiting the building. We are to use the 8051 and it can be written in assembly or c. I tried many assembly programs and can not get them to do anything. Admittidly I am not very good with assembly or C. C Is a bit easier and I have a basic grasp of it.
There will be buttons connected to pins P3.0 and one connected to P3.1 both are set to high when they go low based on the order in which they go low will detirmin if the person is entering or exiting. below is idea for the code I have but I am not sure how to really build it. This is not complete and wont build I know that, just wondering if anyone can give me pointers on making this code

#include <reg51.h>
#include <stdio.h>
#define LCDData P1
void main(void)
char X
char y
(
If(p3.0==0)
        if(p3.1==0)  //when p3.0 the p3.1 go low the person is counted as entering and increments x
        x++;

if(p3.1==0)
        if(p3.0==0) //when p3.1 then p3.0 go low the person is counted as exiting and increments y
        y++;
)
sbit en=p2^0;
display(void)
(
unsigned char message [ ]= "  "  this is where I want the number that X and Y are currently at
unsigned char z;
for(z=0;z<28;z++)
        {
        LCDData=message[z];
        En=1;
        En=0;
}
}

0