Need help writing a ladder logic program for Chapter 10, Problem 6, related to d
ID: 2268355 • Letter: N
Question
Need help writing a ladder logic program for Chapter 10, Problem 6, related to data compare instructions 6. Write a program to perform the following: a. Turn on pilot light 1 (PL1) if the thumbwheel switch value is less than 4. b. Turn on pilot light 2 (PL2) if the thumbwheel switch value is equal to 4. c. Turn on pilot light 3 (PL3) if the thumbwheel switch value is greater than 4. d. Turn on pilot light 4 (PL4) if the thumbwheel switch value is less than or equal to 4. e. Turn on pilot light 5 (PL5) if the thumbwheel switch value is greater than or equal to 4. if possible can you do this in logixpro
Explanation / Answer
Program:
Module pilot-light(s,pl1,pl2,pl3,pl4,pl5,pl6,pl7);
Input (31:0)s;
Output pl1,pl2,pl3,pl4,pl5,pl6,pl7;
Reg pl1;
Reg pl2;
Reg pl3;
Reg pl4;
Reg pl5;
Reg pl6;
Reg pl7;
Intial pl1=0,pl2=0,pl3=0,pl4=0,pl5=0,pl6=0,pl7=0;
Always(s)
Begin
If(s<4) Pl1=1;
else if (s==4) pl2=1;
else if (s>4) pl3=1;
else if (s<=4) pl4=1;
else if (s>=4) pl5=1;
else if (s<6 && s>2) pl6=1;
else if (s<=2 && s>=6) pl7=1;
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.