The full code listing for this lab is as follows<\/span><\/p>\n\/*\n* File: main.c\n* Author: Khaled Magdy\n* Multiple 7-Segments Displays + ADC\n* PIC18F2550 With 4MHz OSC & PLL Config For Fosc=48MHz\n*\/\n#include <xc.h>\n#include \"config.h\"\n\n#define _XTAL_FREQ 48000000\n#define PreLoad 55535\n#define SevenSeg1 PORTB\n#define SevenSeg1_D TRISB\n#define EN1 RC0\n#define EN1_D TRISC0\n#define EN2 RC1\n#define EN2_D TRISC1\n#define EN3 RC2\n#define EN3_D TRISC2\n\nunsigned char Current_Digit=0;\nunsigned char Segments_Code[10] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};\nunsigned char SevenSeg1_Digits[3] = {5, 3, 4};\nunsigned int AD_RES;\n\nvoid TMR1_Init();\nvoid ADC_Init();\nvoid SevenSeg1_Init();\nvoid SevenSeg1_Write(unsigned int);\n\nvoid main(void) {\n\n ADC_Init();\n SevenSeg1_Init();\n while(1) \n {\n\n }\n return;\n}\n\/\/===================================\n\/\/--------------[ ISR ]--------------\nvoid __interrupt() ISR(void)\n{\n if(TMR1IF)\n {\n if(Current_Digit==0) \n {\n SevenSeg1 = 0x00;\n EN1 = 1;\n EN2 = EN3 = 0;\n SevenSeg1 = Segments_Code[SevenSeg1_Digits[0]];\n }\n if(Current_Digit==1)\n { \n SevenSeg1 = 0x00;\n EN2 = 1;\n EN1 = EN3 = 0;\n SevenSeg1 = Segments_Code[SevenSeg1_Digits[1]];\n }\n if(Current_Digit==2)\n {\n SevenSeg1 = 0x00;\n EN3 = 1;\n EN2 = EN1 = 0;\n SevenSeg1 = Segments_Code[SevenSeg1_Digits[2]];\n }\n Current_Digit++;\n if(Current_Digit==3)\n Current_Digit=0;\n TMR1IF = 0;\n AD_RES = (ADRESH<<2)+(ADRESL>>6);\n if(AD_RES>=999) \/\/ Hard-Limit The Max Value To Be Displayed\n AD_RES=999;\n SevenSeg1_Write(AD_RES);\n GO_nDONE = 1;\n TMR1 = PreLoad; \/\/ Preloading Timer1\n }\n}\n\/\/----------[ END OF ISR ]-----------\n\/\/===================================\n\/\/ Functions' Definitions\nvoid TMR1_Init()\n{\n \/\/ -- [[ Configure Timer1 To Operate In Timer Mode ]] --\n \/\/ Preload TMR1 Register Pair\n TMR1 = PreLoad;\n \/\/ Choose the local clock source (timer mode)\n TMR1CS = 0;\n \/\/ Choose the desired prescaler ratio (1:8)\n T1CKPS0 = 1;\n T1CKPS1 = 1;\n \/\/ Switch ON Timer1 Module!\n TMR1ON = 1;\n \/\/ Config TMR1 Interrupt\n TMR1IE = 1;\n TMR1IF = 0;\n PEIE = 1;\n GIE = 1; \n}\nvoid ADC_Init()\n{\n ADCON1 = 0x0D; \/\/ Ref V+ is VDD and Configure pin as analog pin\n ADCON2 = 0x3E; \/\/ Left Justified, 20Tad and Fosc\/64.\n ADCON0 = 0x05; \/\/ Select AN1 \n ADRESH=0;\n ADRESL=0;\n __delay_us(30);\n GO_nDONE = 1;\n}\nvoid SevenSeg1_Init()\n{\n TMR1_Init();\n SevenSeg1_D = 0x00;\n SevenSeg1 = 0x00;\n EN1_D = EN2_D = EN3_D = 0;\n EN1 = EN2 = EN3 = 0;\n}\nvoid SevenSeg1_Write(unsigned int num)\n{\n if(num<=999)\n {\n SevenSeg1_Digits[0] = num \/ 100;\n num%=100;\n SevenSeg1_Digits[1] = num \/ 10;\n num%=10;\n SevenSeg1_Digits[2] = num;\n }\n}<\/pre>\nProject Files Download<\/strong><\/a><\/p>\n\u00a0 \u00a0 \u00a0 \u00a02. Prototyping\u00a0 \u00a0 \u00a0 \u00a0<\/strong><\/span><\/h4>\nHere is a short demo video for the running test for this LAB<\/strong><\/p>\n