Question

Write a C code using a PIC C Compiler Software to program an Elevator prototype as...

Write a C code using a PIC C Compiler Software to program an Elevator prototype as illustrated in the following video.

(pic16f877a)

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#define RED1 PORTB.B0 #define ORANGE1 PORTB.B1 #define GREEN1 PORTB.B2 #define RED2 PORTB.B5 #define ORANGE2 PORTB.B6 #define GREEN2 PORTB.B7 #define REDTIME 1000 #define ORANGETIME 500 //Using #define preprocessor macros will make your //code easier to read, write, update and debug /* Pin Map 0 RED 1 ORANGE 2 GREEN 3 X 4 X 5 RED 6 ORANGE 7 GREEN */ void main() { TRISB=0;//Set PORTB to Output while(1){ RED1=1; ORANGE1=0; GREEN1=0; RED2=0; ORANGE2=0; GREEN2=1; delay_ms(REDTIME); RED1=1; ORANGE1=0; GREEN1=0; RED2=0; ORANGE2=1; GREEN2=0; delay_ms(ORANGETIME); RED1=0; ORANGE1=1; GREEN1=0; RED2=1; ORANGE2=0; GREEN2=0; delay_ms(ORANGETIME); RED1=0; ORANGE1=0; GREEN1=1; RED2=1; ORANGE2=0; GREEN2=0; delay_ms(REDTIME); RED1=0; ORANGE1=1; GREEN1=0; RED2=1; ORANGE2=0; GREEN2=0; delay_ms(ORANGETIME); RED1=1; ORANGE1=0; GREEN1=0; RED2=0; ORANGE2=1; GREEN2=0; delay_ms(ORANGETIME); } }
Add a comment
Know the answer?
Add Answer to:
Write a C code using a PIC C Compiler Software to program an Elevator prototype as...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • using C: Write code for a function with the following prototype: /* * Mask with least...

    using C: Write code for a function with the following prototype: /* * Mask with least signficant n bits set to 1 * Examples: n = 6 --> 0x3F, n = 17 --> 0x1FFFF * Assume 1 <= n <= w */ int lower_one_mask(int n); Your function should follow the bit-level integer coding rules. Be careful of the case n =w.

  • answer in c++ Using the table below, complete the C++ code to write the function prototype...

    answer in c++ Using the table below, complete the C++ code to write the function prototype statement, and the void function header. The void function should receive three double variables: the first two by value and the last one by reference. Name the formal parameters num1, num2 and answer. The function should divide the num1 variable by the num2 variable and then store the result in the answer variable. Name the function calcQuotient. Also write an appropriate function prototype for...

  • in c++ language, using quincy compiler Write a program that will read in 12 characters from...

    in c++ language, using quincy compiler Write a program that will read in 12 characters from the keyboard between a – z in lowercase. These letters will be inserted into a queue (imported from the Queue.h header file). When the 12th character has been entered, the queue will serve the characters one at a time to a character variable, which will push the values, one at a time, into a stack (using code imported from the Stack.h header file) and...

  • Using jGrasp and the Software Development Kit, write a program in response to the following prompt:...

    Using jGrasp and the Software Development Kit, write a program in response to the following prompt: Write a program that prompts the user to input three numbers. This program should then output the numbers in nondescending order. Submit your compiled Java code for this assignment, compress the .java file into a single .zip file.

  • Using pic 16f877a and Micro C languge Design a system (hardware and software) which consists of...

    Using pic 16f877a and Micro C languge Design a system (hardware and software) which consists of a servo motor and two sun detector and pic 16f877a to track the sun. servo motor

  • Write the code of CNC programs for 2 problem by using VR Turning software CNC Program...

    Write the code of CNC programs for 2 problem by using VR Turning software CNC Program RO 42 36 Steps to make simulation Husam Zakha 106/2019 M6 Tolol G S 1200 Fol w 0.4 U 0.4 R.2 2014 10/6/2019 Husam Zakha

  • Write a C program that should run on Linux platform using gcc compiler. You are required...

    Write a C program that should run on Linux platform using gcc compiler. You are required to simulate threads creation and termination behavior by using POSIX threads library. Input: In the main program, first take the value for total number of threads and then ask user to provide the arrival time and CPU time (i.e. running time) for each thread. Output: Simulate the behavior of threads arrival, working and termination at a specific time interval (i.e. 500ms). Requirements: i. Name...

  • Task 2) Write and execute a C program using any C compiler to input students' number...

    Task 2) Write and execute a C program using any C compiler to input students' number of previous semesters attended and marks of all the modules he has studied. And do the following: a. Determine and display grade received for each module studied according to the following conditions: Condition Result Marks is greater than or equal to 91 A Marks is greater than or equal to 70 B Marks is greater than or equal to 50 D Otherwise F b....

  • C++ program by using while loop structure. Write an interactive program (C++) to prompt and read...

    C++ program by using while loop structure. Write an interactive program (C++) to prompt and read two float type numbers, Then your program should perform and print the following arithmetic: (use while loop structure to repeat program 2 times. 1) Sum 2)Difference 3) Product 4) Quotient 5) Modulus (use system defined fmod function) You must use system's defined function prototype and/or to create programmer's defined function prototype for each of the above calculation. In addition, create a function called "DISPLAYLINE...

  • Command Line Arguments: Write a program in C Compiler that will accept two integers on command...

    Command Line Arguments: Write a program in C Compiler that will accept two integers on command line, subtract the second from the first (1st - 2nd) and display the answer. It exactly two numbers are not provided on command line, there should be a simple error message printed and the program ends with no further input, output, or calculations

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT