The input signal of the access control system includes:
- Landing Lever position sensor: Two position value signal (up/down)
- Car entry sensor: Two values (True/false)
- Car Gate sensor: Two values (True/false)
The output signal of the access control system includes:
- Motor control signal for landing lever: (Up/down)
- Traffic light signal: (Red/green)
The passing process of a car is:
- The landing lever is in the falling state and the traffic light is red.
- The car enters the access control system and the entry gate sensor value becomes true.
- Control the ascent of the landing bar until the position sensor reaches the rising position.
- The traffic light is green.
- The car leaves the access control and triggers the car gate sensor value to true.
- Control the drop lever down until the landing pole position sensor reaches the falling position.
- The traffic light turns to a red light.
The state machine of the control system described includes:
- All States of the state machine: 1. The landing lever falls, the traffic light is a red light; 2. The landing lever rises and the light is green.
- External events received by the state machine: 1. Car entry brake; 2. Car Exit brake.
- The action generated by the state machine: 1. Raise the landing pole, the light turns green; 2. Lower the landing lever and the traffic light turns red.
#include <includes.h>uint8_t state = 0;void Sensor_getvalue (uint8_t car_in,uint8_t car_out) { if (car_in = = true) state = 1; if (car_out = = true) state = 2;} void Main () { While{1} { sensor_getvalue (car_in,car_out); Switch (state) {case 1:{while (bar_sensor! = bar_up) {motor = up; Light = Green;} break;} Case 2:{while (bar_sensor! = bar_down) {motor = down; Light = Red;} break;} Default:break;}}}
Real-time control software design second week job-parking access control system state machine design