The PIC18F4321 microcontroller is required to test a NAND gate. The Figure shows the I/O hardware needed to test the NAND gate. The microcontroller is to be programmed to generate the various logic conditions for the NAND inputs. Input the NAND output and turn the LED ON connected at bit 3 of port D if the NAND gate chip is found to be faulty. Otherwise, turn the LED ON connected at bit 4 of port D. +5V +5V Bit 0 of portD Bit 1 of portD D 330 Ω 330 Ω LED ✓ LED Bit 2 of portD Bit 3 of portD Bit 4 of portD PIC18F4321 με Complete the following code to achieve the requirements then copy or upload your completed code

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

#include <xc.h> void ____(void);

void main (void) { TRISDbits.TRISD0 = ____;
TRISDbits.TRISD1 = 0;
TRISDbits.TRISD2 = ____;
TRISDbits.TRISD3 = 0; ____ = 0;

PORTDbits.RD0 = ____; PORTDbits.RD1 = 0; if(____ == 0)
fail();

PORTDbits.RD0 = ____; PORTDbits.RD1 = 1; if(PORTDbits.RD2 == 0)
fail();

____ = 1; PORTDbits.RD1 = 0; if(____ == 0)
____;

PORTDbits.RD0 = ____; PORTDbits.RD1 = ____; if(PORTDbits.RD2 == ____)
fail();

while(1) { PORTDbits.RD3 = 1; PORTDbits.RD4 = 0; } }

void fail(void) { while(1) { PORTDbits.RD3 = ____; PORTDbits.RD4 = ____; } }

The PIC18F4321 microcontroller is required to test a NAND gate. The Figure shows the I/O
hardware needed to test the NAND gate. The microcontroller is to be programmed to generate the
various logic conditions for the NAND inputs. Input the NAND output and turn the LED ON
connected at bit 3 of port D if the NAND gate chip is found to be faulty. Otherwise, turn the LED ON
connected at bit 4 of port D.
+5V
+5V
Bit 0 of portD
Bit 1 of portD
D
330 Ω
330 Ω
LED
✓ LED
Bit 2 of portD
Bit 3 of portD
Bit 4 of portD
PIC18F4321
με
Complete the following code to achieve the requirements then copy or upload your completed
code
Transcribed Image Text:The PIC18F4321 microcontroller is required to test a NAND gate. The Figure shows the I/O hardware needed to test the NAND gate. The microcontroller is to be programmed to generate the various logic conditions for the NAND inputs. Input the NAND output and turn the LED ON connected at bit 3 of port D if the NAND gate chip is found to be faulty. Otherwise, turn the LED ON connected at bit 4 of port D. +5V +5V Bit 0 of portD Bit 1 of portD D 330 Ω 330 Ω LED ✓ LED Bit 2 of portD Bit 3 of portD Bit 4 of portD PIC18F4321 με Complete the following code to achieve the requirements then copy or upload your completed code
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY