00:01
Hello student, to precisely measure the toggling interval on the output pin connected to the blue led using an oscilloscope, follow these steps.
00:11
Connect the oscilloscope probe to the output pin connected to the blue led.
00:15
Number 2, set the oscilloscope to the trigger on the rising edge of the signal.
00:20
Set the oscilloscope to measure the time between the rising edge.
00:24
Now start the oscilloscope and run the code that generates the delay.
00:28
Observe the oscilloscope to measure the toggling interval.
00:32
The approximate number of the loop iteration to generate a 1 millisecond delay can be determined by dividing the toggling interval by the loop count.
00:43
So this can be, this can generate the delay.
00:46
So here to complete the msdelay function, add the following code to the loop.
00:52
So we can add this to generate a 1 millisecond delay.
00:57
The assembly code will cause the cpu, this is assembly code.
01:02
This assembly code cause the cpu to enter a low power state of 1 clock cycle.
01:08
The number of the clock cycle per millisecond will vary depending on the cpu clock frequency.
01:14
However, in the mos cpu, the number of the clock cycle per millisecond is approximate 1000.
01:21
Therefore, the above assembly code will generate a delay of approximate 1 millisecond.
01:27
So with the help of this, we can generate the delay.
01:30
To use the msdelay function to replace the loop that generate the delay in the program given in the tutorial, simply change the loop to the following, msdelay 1 underscore second.
01:42
So 1 underscore second macro should be defined to the number of the millisecond in 1 second...