Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include //include HITECH C Compiler header file /*CONFIGURATION*/ __CONFIG(FOSC_INTOSCIO & WDTE_OFF & PWRTE_ON & BOREN_OFF & LVP_OFF & CP_OFF & CPD_OFF); #define _XTAL_FREQ 4000000L //INTERNAL

image text in transcribed

#include //include HITECH C Compiler header file /*CONFIGURATION*/ __CONFIG(FOSC_INTOSCIO & WDTE_OFF & PWRTE_ON & BOREN_OFF & LVP_OFF & CP_OFF & CPD_OFF); #define _XTAL_FREQ 4000000L //INTERNAL 4MHz CLOCK // GLOBAL VARIABLE DECLARATION unsigned char IntFile; /*CODE ORIGIN*/ void main() { //OSCF=0X01; //INTOSC Oscillator Frequency set at 48KHZ GIE = 1; // enable general interrupt INTE = 1; //INTERRUPTS at pin RB0/INT enabled INTEDG = 1; //RISING-EDGE TRIGGERD INTERRUPT ENABLED AT PIN RBO/INT TRISA=0x00; //ALL pins at PORTA SET to OUTPUT PORT TRISB=0x01; //PORTB RB0 pin SET to input, rest OUTPUT PORTB=0x00; //clear PORTB for wrong signalling while(1){ PORTB=0x90; //NORTH RED, WEST AMBER __delay_ms(4000); //LOOP 4 TIMES, 4-SECOND DELAY PORTB=0xD0; //NORTH RED AND AMBER, WEST RED __delay_ms(4000); //LOOP 4 TIMES, 4-SECOND DELAY PORTB=0x30; //NORTH GREEN, WEST RED __delay_ms(10000); //LOOP 10 TIMES, 25-SECOND DELAY PORTB=0x50; //NORTH AMBER, WEST RED __delay_ms(4000); //LOOP 4 TIMES, 4-SECOND DELAY PORTB=0x90; //NORTH RED, SDRY RED __delay_ms(4000); //LOOP 4 TIMES, 4-SECOND DELAY PORTB=0x98; //NORTH RED, WEST RED AND AMBER __delay_ms(4000); //LOOP 4 TIMES, 4-SECOND DELAY PORTB=0x84; //NORTH RED, WEST GREEN __delay_ms(10000); //LOOP 25 TIMES, 25-SECOND DELAY PORTB=0x88; //NORTH RED, WEST AMBER __delay_ms(4000); //LOOP 4 TIMES, 4-SECOND DELAY if (IntFile==0xFF){ //Check if there was a pin change on RB0/INT pin RA0 = 0; PORTB=0x92; //NORTH TRAFFIC RED, WEST TRAFFIC RED, PIEZZO SOUNDER ACTIVATED __delay_ms(10000); //LOOP 15 TIMES, 15-SECOND DELAY IntFile = 0; //clear interrupt bit } } //END WHILE } //END MAIN void interrupt isr(void) // Interrupt function { if(INTF==1){ // check if pedestrian button is pressed RA0 = 1; //light up LED for wait IntFile = 0xFF; INTF=0; // clear flag bit } return; }

Can anyone explain the function of R1, R2 and R3 in the circuit and explain the coding? This is a pedestrian traffic light project.

SOUNDER LS1 R1 10% R3 16 15 17 18 U1 RATOSC 1.CLKIN RADNO R4509C2CLIOUT RA1/AN1 RAZIANZWREF RAVICLR RAWAN3CMP1 RAWTDC KICMP2 100 + NORTH TRAFFIC LIGHTS 2 3 RBOINT RB 1/RX/DT R82TXCK R8CCP1 RUL RBS FR6T1090/T1CH R87/T10SI 6 7 8 9 10 11 12 13 WEST TRAFFIC LIGHTS OD PIC16F648A D1 WAIT INDICATOR BUTTON R2 10% TITLE: DATE: Traffic Light Controller 30/08/14 PAGE: BY: REV: Uchelor 10 1/1 SOUNDER LS1 R1 10% R3 16 15 17 18 U1 RATOSC 1.CLKIN RADNO R4509C2CLIOUT RA1/AN1 RAZIANZWREF RAVICLR RAWAN3CMP1 RAWTDC KICMP2 100 + NORTH TRAFFIC LIGHTS 2 3 RBOINT RB 1/RX/DT R82TXCK R8CCP1 RUL RBS FR6T1090/T1CH R87/T10SI 6 7 8 9 10 11 12 13 WEST TRAFFIC LIGHTS OD PIC16F648A D1 WAIT INDICATOR BUTTON R2 10% TITLE: DATE: Traffic Light Controller 30/08/14 PAGE: BY: REV: Uchelor 10 1/1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions