0% found this document useful (0 votes)
21 views2 pages

Lab 3 Light An LED

The document provides instructions for 5 exercises to light an LED using the MPLAB simulator. The exercises include sending values to port B from 0x00 to 0xFF, sending ASCII character hex values to port B from a character array, sending integer values from -6 to 6 to port B from an array, toggling all bits of port B 25,000 times starting at 0x55, and modifying the prior program to include a 250ms delay between each toggle.

Uploaded by

Preet Dhillon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Lab 3 Light An LED

The document provides instructions for 5 exercises to light an LED using the MPLAB simulator. The exercises include sending values to port B from 0x00 to 0xFF, sending ASCII character hex values to port B from a character array, sending integer values from -6 to 6 to port B from an array, toggling all bits of port B 25,000 times starting at 0x55, and modifying the prior program to include a 250ms delay between each toggle.

Uploaded by

Preet Dhillon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

COMP551 – Interfacing

Winter 2022

Lab 3

Light an LED Using the MPLAB Simulator

Navpreet Kaur
Student:

10270950
Student ID:

Section: 2

Exercises:

1. Write a program to send the values 0x00 to 0xFF, to Port B, only once. Use the
simulator to see how Port B displays the values 0x00 to 0xFF in binary.

2. Write a program to read from memory, then send hex values for the ASCII
characters A, B, C, D, E, F, 0, 1, 2, 3, 4, 5 to Port B. The characters are stored in
RAM using the following command;

char ‘variable name’[]= "ABCDEF012345";

Run the program in the simulator to see how Port B displays the hex values of each
ASCII character.

3. Write a program to send values of -6 to +6 to Port B. The values are to be stored in


memory using the following command;

char ‘variable name’[] = {-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6};

Run the program in the simulator to see how Port B displays the hex values of
number.

4. Write a program to toggle all bits of Port B, 25,000 times. Start with 0x55 as the
output. Run the program in the simulator to verify the code.

5. Modify the program in exercise 4, to include a 250 ms delay after each time the bits
are toggled. Make the delay a function (ie. Delay1TCY(), Delay10TCYX(),
Delay100TCYx(), Delay1KTCYx(), etc.)

You might also like