Today's goal is to measure the time between external interrupts.
External INT on a PIC16LF1708 is on RA2. Use the internal weak pull-up.
It's not that easy to find where to set, so I'll put it here. Use MCC's Pin Module to enable the register. In order to set individual pull-ups (rather than a whole port at once), the WPUEN bit must be enabled.
Then:
- Go to ISR
- Set Timer0 to 0
- Count until next EXT interrupt // here I am using a wire on A2
- Timer0 = elapsedTime
- elapsedTime - 0 = time
- Timer0 = 0
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.