Question

In: Electrical Engineering

To develop a program for the PIC 16F84A using either MPLAB X IDE simulator software. T...

To develop a program for the PIC 16F84A using either MPLAB X IDE simulator software. T

he PIC 16F84A has 8 LEDs connected to Port B. The program is to convert your student number (10 ASCII characters), taken in reverse order, one character at a time, to Gray code.

Each converted character is to be displayed on 4 of the LEDs connected to Port B (B0 to B3) of the microcontroller.

Further, each converted character will be displayed for 3 seconds, with the LEDs turned OFF for 1 second between each character. Once all characters have been displayed the program will continue to run with all of the Port B LEDs flashing in a pattern of Odd Numbered LEDs On and Even Numbered LEDS Off for 1 second, and then Odd Numbered LEDs Off and Even Numbered LEDS On for 1 second. This pattern will repeat indefinitely.  

Solutions

Expert Solution

Input code:-

int led = 13;

int led2 = 12;

int led3 = 11;

int led4 = 10;

int led5 = 9;

int led6 = 6;

int led7 = 5;

int led8 = 3;

// the setup routine runs once when you press reset:

void setup() {

// initialize the digital pin as an output.

pinMode(led, OUTPUT);

pinMode(led2, OUTPUT);

pinMode(led3, OUTPUT);

pinMode(led4, OUTPUT);

pinMode(led5, OUTPUT);

pinMode(led6, OUTPUT);

pinMode(led7, OUTPUT);

pinMode(led8, OUTPUT);

}

// the loop routine runs over and over again forever:

void loop() {

{digitalWrite(led, HIGH);

delay (15);

digitalWrite(led, LOW);

delay(15);

digitalWrite(led, HIGH);

delay(15);

digitalWrite(led, LOW);

delay(15);}

{digitalWrite(led2, HIGH);

delay (15);

digitalWrite(led2, LOW);

delay(15);

digitalWrite(led2, HIGH);

delay(15);

digitalWrite(led2, LOW);

delay(15);}

{digitalWrite(led3, HIGH);

delay (15);

digitalWrite(led3, LOW);

delay(15);

digitalWrite(led3, HIGH);

delay(15);

digitalWrite(led3, LOW);

delay(15);}

{digitalWrite(led4, HIGH);

delay (15);

digitalWrite(led4, LOW);

delay(15);

digitalWrite(led4, HIGH);

delay(15);

digitalWrite(led4, LOW);

delay(15);}

{digitalWrite(led5, HIGH);

delay (15);

digitalWrite(led5, LOW);

delay(15);

digitalWrite(led5, HIGH);

delay(15);

digitalWrite(led5, LOW);

delay(15);}

{digitalWrite(led6, HIGH);

delay (15);

digitalWrite(led6, LOW);

delay(15);

digitalWrite(led6, HIGH);

delay(15);

digitalWrite(led6, LOW);

delay(15);}

{digitalWrite(led7, HIGH);

delay (15);

digitalWrite(led7, LOW);

delay(15);

digitalWrite(led7, HIGH);

delay(15);

digitalWrite(led7, LOW);

delay(15);}

{digitalWrite(led8, HIGH);

delay (15);

digitalWrite(led8, LOW);

delay(15);

digitalWrite(led8, HIGH);

delay(15);

digitalWrite(led8, LOW);

delay(15);

{digitalWrite(led8, HIGH);

delay (15);

digitalWrite(led8, LOW);

delay(15);

digitalWrite(led8, HIGH);

delay(15);

digitalWrite(led8, LOW);

delay(15);}

{digitalWrite(led7, HIGH);

delay (15);

digitalWrite(led7, LOW);

delay(15);

digitalWrite(led7, HIGH);

delay(15);

digitalWrite(led7, LOW);

delay(15);}

{digitalWrite(led6, HIGH);

delay (15);

digitalWrite(led6, LOW);

delay(15);

digitalWrite(led6, HIGH);

delay(15);

digitalWrite(led6, LOW);

delay(15);}

{digitalWrite(led5, HIGH);

delay (15);

digitalWrite(led5, LOW);

delay(15);

digitalWrite(led5, HIGH);

delay(15);

digitalWrite(led5, LOW);

delay(15);}

{digitalWrite(led4, HIGH);

delay (15);

digitalWrite(led4, LOW);

delay(15);

digitalWrite(led4, HIGH);

delay(15);

digitalWrite(led4, LOW);

delay(15);}

{digitalWrite(led3, HIGH);

delay (15);

digitalWrite(led3, LOW);

delay(15);

digitalWrite(led3, HIGH);

delay(15);

digitalWrite(led3, LOW);

delay(15);}

{digitalWrite(led2, HIGH);

delay (15);

digitalWrite(led2, LOW);

delay(15);

digitalWrite(led2, HIGH);

delay(15);

digitalWrite(led2, LOW);

delay(15);}

{digitalWrite(led, HIGH);

delay (15);}

digitalWrite(led, LOW);

delay(15);

digitalWrite(led, HIGH);

delay(15);

digitalWrite(led, LOW);

delay(15);}

}


Related Solutions

In MPLAB write and compile (using the simulator) an assembly language program with the following functionality:...
In MPLAB write and compile (using the simulator) an assembly language program with the following functionality: Configures pin RA2 of the PIC24to be an output to control an attached LED. Configures pin RB13 of the PIC24 to be an input to read the value on an attached switch (this switch will connect to ground when pressed). Configures pin RB13 to use the internal pull-up resistor. After configuration, the LED will be "off" when the push-button is pressed, and "on" when...
Write a Program using MPLAB IDE and XC8 compiler to do the followings: 1. When the...
Write a Program using MPLAB IDE and XC8 compiler to do the followings: 1. When the Program Starts it should send your Name and ID# to the Serial Port 2. Display the result on Tera Term. 3. Read PORTB buttons in an infinite loop (Main Loop which is the Read Buttons Loop), your program should not block when reading the Buttons except in De-bouncing.. But you need to de-bounce each button when pressed 3.1 If the user presses PORTB, RB0...
Control DC Using PIC18f46k20 and MPLAB IDE v8.8, write a program that can 1. Start and...
Control DC Using PIC18f46k20 and MPLAB IDE v8.8, write a program that can 1. Start and Stop the motor 2.Vary The motor Speed 3.Change the direction of the motor rotation 4.Display motor speed in OLED screen using c of MPLAB IDE v8.8 please test the code before posting
Create a schematic of a circuit using and write C program to run on a PIC...
Create a schematic of a circuit using and write C program to run on a PIC 16F88 that will flash between a red and green LED at 5Hz with the green on 75% of the time and the red on 25% of the time.
C++ program using Eclipse IDE The C++ program should have concurrency. The C++ program should create...
C++ program using Eclipse IDE The C++ program should have concurrency. The C++ program should create 2 threads that will act as counters. One thread should count down from 5 to 0. Once that thread reaches 0, then a second thread should be used to count up to 20.
Using Eclipse IDE Create a Java Program/Class named MonthNames that will display the Month names using...
Using Eclipse IDE Create a Java Program/Class named MonthNames that will display the Month names using an array. 1. Create an array of string named MONTHS and assign it the values "January" through "December". All 12 months need to be in the array with the first element being "January", then "February", etc. 2. Using a loop, prompt me to enter an int variable of 1-12 to display the Month of the Year. Once you have the value, the program needs...
Create a Java Program to calculate luggage costs. USING ECLIPSE IDE The Business Rules are: A....
Create a Java Program to calculate luggage costs. USING ECLIPSE IDE The Business Rules are: A. Two bags per person are free. B. The Excess Bag Charge is $75 per bag. The program needs to do the following: 1. In your main method(),    Create integers to store the number of Passengers and also the total number of bags    Prompt for the number of passengers on a ticket.    Prompt for the total number of bags for all passengers...
Using ECLIPSE IDE Write a Java Program to play your version of the Texas Pick 3...
Using ECLIPSE IDE Write a Java Program to play your version of the Texas Pick 3 Lottery. You will need to include the provided code given below in your program. Task:The program will prompt for a number between 0 and 999. Your program will display the number of attempts it took for the entered number to match a randomly generated number. In the main() method, declare an int named myPick3choice. Create a prompt for myPick3choice as "Enter your Pick 3...
SS Inc. begins to develop a computer software program that can be sold to the public....
SS Inc. begins to develop a computer software program that can be sold to the public. During the current year, costs of $270,000 are incurred to arrive at the point of technological feasibility (a working model is available). Another $130,000 is then spent to turn that working model into a product that can be sold. Which of the following statements is true? A)$400,000 should be recorded as an expense in this year. B)$400,000 should be recorded as an asset to...
Using a​ t-distribution table or software or a​ calculator, report the​ t-statistic which is multiplied by...
Using a​ t-distribution table or software or a​ calculator, report the​ t-statistic which is multiplied by the standard error to form the margin of error for the following cases. a. 90% confidence interval for a mean with 16 observations. b. 90% confidence interval for a mean with 26 observations. c. 98% confidence interval for a mean with 26 observations. a. t = _____ (round to three decimal places) b. t = _____ (round to three decimal places) c. t =...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT