MPLAB - Assignment 6
Goal
1. How to use Assembly control port on PIC18F4520
2. How to control connect picket 4 to computer
3. How to use jump wires on breadboard
Simple Tutorial
I/O ports of PIC18F4520
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
Components
- breadboard
- pickit3 or pickit4
- PIC18F4520 transistor
- computer
- jump wires : many
- resistor : many
- led : 5
- button : 1
Connect
here is a example for test to MPLAB
- just copy this code
- click Debug project
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
- Warnning!
- If you don't have this warnning, congradulation, just skip this point
- If you have this problem, don't worry, The system just trying to tell you to be carefully sure that the transistor your use should be PIC18F4520. Thererfore, just click
OK
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
Circuit
- all
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
- Remember that led should be insert in breadboard by this direction
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
- Insert the resistor into the board with one end in the same horizontal row as the LEDβs cathode (short) leg and the other a few rows down. The resistor is not polarized so it does not matter which direction you insert it.
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
Run
Everytime press button, the led will light or turn off. If you are successful, go down and have chanllenge of other examples!
Basic Example
Description
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
Code
Circuit
-
Button : Connect a push-button at RB0 port with pull-up or pull-down resistor.
-
LED : Connect four LEDs at RA0 ~ RA3 port. Press the button to change the blinking pattern of LEDs, as in the figure below.
-
Remember that every oled usually used in tandem with a resistance to protect led from too large voltage and prevent floating state(Use pull-down resistor)

-
Prevent floating state : Use pull-up resistor

Result
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
demo
Advanced Example
Description

Code
Bonus Example
Description

Code
Result
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
demo
Reference
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
How to Use a Breadboard and Build a LED Circuit
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
How to write delay in MPLAB
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More β
PIC18Fxxx Instruction Set