05/06/2023
The next tutorial will be presented in Assembly, using Microchip's MPASM toolchain version 5.81 which is also installed when MPLAB X IDE version 5.05 is installed.
This tutorial will feature a switch input, for which we will be looking at delays required to prevent false inputs due to switch contact "chatter" or bounce.
There are a few methods to achieve delays, however using Assembly requires a little more effort, we will apply these delays for both the pressed and released states of the switch, setting an Output Low to turn on an LED and then resetting the LED to a High state, so to turn Off the LED on the second pressed state.
This will not be the normal use of a delay to toggle the LED. I will go over a PIC's System Clock and how to calculate the Instruction Cycle period with calculations for loops to generate a suitable delay period for the purpose of "debouncing" or filtering out of false inputs from a switch.
We will use the included Simulator and Stopwatch of the Free MPLAB X IDE software to verify the delay periods and testing of the program to switch the LED on and off for alternate switch presses, allowing the tutorial to be followed even with out the need to purchase the PIC device or programmer. We will also use a real PIC16F1705 device and the PICKit4 Programmer and Debugger.
The simulator can then be used with any PIC device to test various System Clock settings and required delay periods.
The MPASM Toolchain is required to follow this tutorial. Note that the newer MPLAB X IDE's do not have the MPASM Toolchain option as this has been replaced with the PIC-AS toolchain which requires some alternative methods of including Assembly within program sections. Windows has the MPASM toolchain included in later versions of MPLAB X IDE, I believe the last was v5.35 for 64 bit machines and MAC has the Toolchain included with v5.05. Please refer to the second Trailer video "Software Installations" for various Operating System MPLAB X IDE versions required for Assembly and C tutorials. The links to the archived versions of MPLAB X IDE is included in the Software Installations "About" or more about the video section.