Real-time control software design second week job-parking access control system state machine design

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.