Microcontroller Question

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Microcontroller Question

Post by answerhappygod »

Microcontroller Question
Microcontroller Question 1
Microcontroller Question 1 (354.7 KiB) Viewed 16 times
Figure 1 shows a Pedestrian Stop Traffic Light system which stops the cars using the traffic light when the push button is pushed. Traffic Light -Push Button Figure 1: Pedestrian crossing traffic light system
VDD D2 R1 A 280 LED-RED 34 35 36 37 42 43 44 1 D3 R2 280 U1 19 RAOVANO/C1IN- RCO/T1OSO/T13CKI 20 21 RA1/AN1/C2IN RC1/T10SI/CCP2B 22 RA2/AN2/C2IN/VREF-/CVREF RC2/CCP1/P1A RA3/AN3/C1IN+/VREF+ 23 RC3/SCK/SCL RA4/TOCK/C10UT RCA/SDUSDA 24 RA5/AN/SS/HLVDIN/C2OUT 33 RC5/SDO RAB/OSC2/CLKO 32 RCB/TX/CK RA7/OSC1/CLKI / RC7/RX/DT 9 RBOVAN12/FLTO/INTO 10 RDO/PSPO 11 RB1/AN101NT1 RD1/PSP1 RB2/AN/INT2 RD2/PSP2 12 RB3/AN9/CCP2A RD3/PSP3 RB4/KBIO/AN11 15 RD4/PSP4 16 RB5/KBI1/PGM RD5/PSP5/P1B RBG/KBI2/PGC 17 RD6/PSP/P1C RB7/KBIa/PGD RDT/PSP7/P1D LED-YELLOW D1 38 39 40 41 2 3 4 5 R3 280 LED-GREEN VDD 4 25 26 27 18 REO/RD/AN5 RE1/WRANG RE2/CS/ANY RE3/MCLR/VPP PUSH BUTTON La O PIC18F4525 Figure 2: Circuit simulation for pedestrian crossing traffic light system Figure 2 shows a circuit simulation for the Pedestrian Stop Traffic Light represented with the corresponding LED colors. Initially, the Traffic Light is GREEN. After the stop button is pushed, the YELLOW light will turn on for 10 seconds, and then the Traffic Light will change to RED for 30 seconds. After that, the Traffic light will return back to GREEN. You are required to design the system using PIC18F4525 microcontroller based on all given conditions,
Figure 2 shows a circuit simulation for the Pedestrian Stop Traffic Light represented with the corresponding LED colors. Initially, the Traffic Light is GREEN. After the stop button is pushed, the YELLOW light will turn on for 10 seconds, and then the Traffic Light will change to RED for 30 seconds. After that, the Traffic Light will return back to GREEN. You are required to design the system using PIC18F4525 microcontroller based on all given conditions. (a) Draw the process flowchart for the program (12 Marks) (b) Fill in the code snippet below shown in Figure 2 to run the program as required (0) Write the appropriate values for PORT, TRIS, ADCONO, ADCON1 and OSCCON for the circuit (OSCCON set internal oscillator to 4Mhz with stable output without sleep) (ii) Write the code for turning the respective color LEDs on and off and the delays needed when push button is pushed for it to operate as designed (20 Marks)
#include <xc.h> unsigned char n,i; void delay (unsigned char t) //delay function in seconds { for (n = 0; n < t; n++) { for (i=0; i<100; i++)//run delay_ms for 100 times { __delay_ms(10);//delay for 0.01seconds } } } void main(void) { //main function (i)Write the appropriate values for PORT, TRIS, ADCONO, ADCON1 and OSCCON for the circuit (OSCCON set internal oscillatorto 4Mhz with stable output without sleep) while (1) { (ii)Write the code for turning the respective color LEDs on and off and the delays needed when push button is pushed for it to operate as designed }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply