Hardware Reference
In-Depth Information
Car_times() function
This function stores cars' entry and exit time in the relevant variables. At the first time,
the whole parking is scanned by read_mux function. Then in a loop, each slot is checked.
read_mux();
for(x=1;x<17;x++)
{
If there is a parking slot then its key is activated and if it wasn't checked previously, then
the entrance time and date are stored in related variables. And if counter_perm (go back to
read_gates function) is 1, the parking capacity is decreased by one unit.
if((car[x]==1)&&(car_perm[x]==0))
{
car_day_in[x]=day;
car_month_in[x]=month;
car_hour_in[x]=hour;
car_min_in[x]=minute;
car_sec_in[x]=sec;
car_perm[x]=1;
sum_of_cars();
if((capacity_sam<capacity)&&(counter_perm==1))
{
capacity--;
counter_perm=0;
}
}
The exit time for each parking slot is recorded when the state of a slot (for example
car[5] variable for 5 th slot) is zero and its entrance time is recorded before and the exit time
isn't recorded still. Because it means the parked car in 5 th slot exit from 5 th slot and is leav-
ing the parking, so the exit time should be recorded in related variable to compute its park-
Search WWH ::




Custom Search