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.

Automatic Door using RIMS

Status
Not open for further replies.

John Pinares

Newbie level 4
Joined
Aug 31, 2014
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
55
Hi everyone. I have this assignment I have to do using RIMS and I need help coming up with an algorithm. The assignment is this:

An automatic door at a store has a sensor in front (A0) and behind (A1). The
door opens (B0=1) when a person approaches from the front, and stays open as
long as a person is detected in front or behind. If the door is closed and a person
approaches from the behind, the door does not open. If the door is closed and a
person approaches from the front but a person is also detected behind, the door
does not open, to prevent hitting the person that is behind.

Specifically the first one.
When A0 = 1 then B0=1 and stays 1 as long as A0 or A1 are 1, but the next part says if A1=1 then B0=0. Here is my code so far
Code:

Code:
void main()
{
   while (1) { 
       if(!A0 && !A1)
       {
           !B0;
       }
      if(A0 && !A1)
      {
            B0 = 1;
      }
      if (A1)
      {
            B0 = 0;
      }
      /*if (A1 && A0)
      {
            !B0;
      }*/
   }
}

the current outcome. Right now when I flip A0, B0 lights up but when I flip A0 back and flip A1, B0 shuts off. Then when I set both A0 and A1 to 1, B0 starts flashing.
Thank you in advanced. Also if anyone knows how to use the RIBS software or knows a good tutorial may you please share. Thanks!
 

you are doing each test in seqience so a following test may invert a previous test therefore B0 flashes - try some les e statements, e.g
Code:
      if (A1)
      {
            B0 = 0;
      }
     else
      if (A1 && A0)
      {
            !B0;
      }
 

man did that help! Thanks a ton. Here's the final code, if anyone could run it and see if it meets the qualifications or if you have any input, it is appreciated and welcome. Thanks again!

Code:
#include "rims.h"

int main()
{
   while (1) 
   {
    if (!B0)
    {
        if (A0 && !A1)
        {
            B0=1;
            if (B0 && A1)
            {
                B0=1;
            }
            else if (!A0 && A1)
            {
                B0 = 0;
            }
            else if (!B0 && A1)
            {
                 if(A0)
                 {
                     B0=0;
                 }
            }
            
   
        }
        
    } 
    else if (!A0 && !A1)
    {
        B0=0;
    }
    
    
   }
}
 

Explain the conditions you need and also the value of required B0 for different conditions. I will write a working code.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top