Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Do you really want to delete this prezi?
Neither you, nor the coeditors you shared it with will be able to recover it again.
Make your likes visible on Facebook?
Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.
Week 11 - intro to C
Transcript of Week 11 - intro to C
feed watch dog:
//loose ends 2
if(PTDD&0x01) //not pressed
else // pressed
//loose ends 3
while ((ATDSC & 0x80) == 0);
used to accurately run periodic events
TMPxSC = TMP1SC and TMP2SC
when counter value reaches modulo:
TOF (timer overflow) is set
interrupt can be caused
//setting up timers
decide on origin of clock pulse
setup TMPxSC (including prescaler)
decide of modulo value (both bytes)
set up interrupt
//modulo and prescaler
1. Decide, in seconds, how long your delay must be.
2. Assume bus frequency of 20Mz.
3. The cycle length will be the reciprocal of the bus frequency.
4. Divide the delay length by the cycle length to calculate the number of cycles needed.
5. Divide the number of cycles by 65536 (2^16)
If the result is bigger than 128 then your time delay is too long and you will need
multiple timer periods. The rounded up number is your prescaler value.
6. Divide the number of cycles by the prescaler value. The result is the modulo value.
cycleLength = 1/F = 50ns
cyclesNeeded = delay/cycleLength
generate a delay of 0.1s
= 2 000 000
prescaler = cyclesNeeded/65536
prescaler = 32
modulo = cyclesNeeded/prescaler
modulo = 62500
62500 = 0xF424
TPMxMOD = 0xF424;