📄 timer.ppl
字号:
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 6
*/
271 : TM0n_PRM0n_CountClock_Internal2 : fprs/2^8 or
272 : TM0n_PRM0n_CountClock_TI00nEdge
273 : TM0n_PRM0n_TI00nEdge_Falling or
274 : TM0n_PRM0n_TI01nEdge_Rising or
275 : TM0n_PRM0n_TI01nEdge_Both
276 : Note : Please select the higher frequency you can,
277 : so the precision will be higher.
278 : */
279 : #define TM00_Clock TM0n_PRM0n_CountClock_Internal0
280 : /*
281 : Value range : 0x0001 - 0xffff
282 : Pulse cycle = (CR00n_value + 1) * count_clock
283 : Duty = (CR01n_value + 1) / (CR00n_value + 1)
284 : CR01n_value < CR00n_value
285 : */
286 : #define TM00_CR00nValue 0x5dbf
287 : #define TM00_CR01nValue 0x1c1f
288 :
289 : /* Register settings */
290 : #define TM00_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
291 : #define TM00_PRM0nValue TM00_Clock
292 : #define TM00_CRC0nValue TM0n_CRC0n_CR01nMode_Compare| TM0n_CRC0n_C
: R00nMode_Compare
293 : #define TM00_TOC0nValue TM0n_TOC0n_OneshotMode_Successive| TM0n
: _TOC0n_ReverseTO0nByCR01n_Enable| /* Value selection
294 : TM0n_TOC0n_TO0nOut_NoChange
295 : TM0n_TOC0n_TO0nOut_Clear0
296 : TM0n_TOC0n_TO0nOut_Set1
297 : */ TM0n_TOC0n_T
: O0nOut_Clear0| TM0n_TOC0n_TO0nReverseByCR00n_Enable|
: TM0n_TOC0n_TO0nOut_Enable
298 :
299 : /* Interrupt settings */
300 : #define TM00_INTTM000 0
301 : #define TM00_INTTM010 0
302 :
303 :
304 : /*
305 : ***************************************
306 : ** TM01 configure
307 : **
308 : ** Please set operation mode here
309 : ***************************************
310 : */
311 : /* if no use set nouse = 1, if use some function set function = 1 */
312 : #define TM01_NotUse 0
313 : #define TM01_Interval 0
314 : #define TM01_ExternalEvent 0
315 : #define TM01_SquareOut 0
316 : #define TM01_PPGOut 1
317 : #define TM01_OneshotOut 0
318 : #define TM01_PulseMeasurement 0
319 : /* if no use some method of pulse measurement set method = 1 */
320 : #define TM01_Pulse_TI00nAndTI01nFreeRunning 0
321 : #define TM01_Pulse_TI00nFreeRunning 0
322 : #define TM01_Pulse_TI00nRestart 1
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 7
*/
323 :
324 : /* macro for setting of different functions */
325 :
326 : /*
327 : ***************************************
328 : ** TM01 PPG output
329 : **
330 : ** user set cycle = 0.006s, duty = 60%
331 : ***************************************
332 : */
333 :
334 : /* Count clock and compare value */
335 : /* Use register bit macro
336 : TM0n_PRM0n_CountClock_Internal0 : fprs or
337 : TM0n_PRM0n_CountClock_Internal1 : fprs/2^4 or
338 : TM0n_PRM0n_CountClock_Internal2 : fprs/2^6 or
339 : TM0n_PRM0n_CountClock_TI00nEdge
340 : TM0n_PRM0n_TI00nEdge_Falling or
341 : TM0n_PRM0n_TI01nEdge_Rising or
342 : TM0n_PRM0n_TI01nEdge_Both
343 : Note : Please select the higher frequency you can,
344 : so the precision will be higher.
345 : */
346 : #define TM01_Clock TM0n_PRM0n_CountClock_Internal0
347 : /*
348 : Value range : 0x0001 - 0xffff
349 : Pulse cycle = (CR00n_value + 1) * count_clock
350 : Duty = (CR01n_value + 1) / (CR00n_value + 1)
351 : CR01n_value < CR00n_value
352 : */
353 : #define TM01_CR00nValue 0xbb7f
354 : #define TM01_CR01nValue 0x707f
355 :
356 : /* Register settings */
357 : #define TM01_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
358 : #define TM01_PRM0nValue TM01_Clock
359 : #define TM01_CRC0nValue TM0n_CRC0n_CR01nMode_Compare| TM0n_CRC0n_C
: R00nMode_Compare
360 : #define TM01_TOC0nValue TM0n_TOC0n_OneshotMode_Successive| TM0n
: _TOC0n_ReverseTO0nByCR01n_Enable| /* Value selection
361 : TM0n_TOC0n_TO0nOut_NoChange
362 : TM0n_TOC0n_TO0nOut_Clear0
363 : TM0n_TOC0n_TO0nOut_Set1
364 : */ TM0n_TOC0n_T
: O0nOut_Clear0| TM0n_TOC0n_TO0nReverseByCR00n_Enable|
: TM0n_TOC0n_TO0nOut_Enable
365 :
366 : /* Interrupt settings */
367 : #define TM01_INTTM001 0
368 : #define TM01_INTTM011 0
369 :
370 :
371 : /*
372 : ***************************************
373 : ** TM50 configure
374 : **
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 8
*/
375 : ** Please set operation mode here
376 : ***************************************
377 : */
378 : /* if no use set nouse = 1, if use some function set function = 1 */
379 : #define TM50_NotUse 0
380 : #define TM50_Interval 0
381 : #define TM50_ExternalEvent 0
382 : #define TM50_SquareOut 0
383 : #define TM50_PWMOut 1
384 :
385 :
386 : /*
387 : ***************************************
388 : ** TM50 PWM output
389 : **
390 : ** user set cycle = 0.002048s, duty = 40%
391 : ***************************************
392 : */
393 :
394 : /* Count clock and compare value */
395 : /* Use register bit macro
396 : TM5n_TCL5n_CountClock_Internal0 : fprs
397 : TM5n_TCL5n_CountClock_Internal1 : fprs/2
398 : TM5n_TCL5n_CountClock_Internal2 : fprs/2^2
399 : TM5n_TCL5n_CountClock_Internal3 : fprs/2^6
400 : TM5n_TCL5n_CountClock_Internal4 : fprs/2^8
401 : TM5n_TCL5n_CountClock_Internal5 : fprs/2^13
402 : Note : Please select the higher frequency you can,
403 : so the precision will be higher.
404 : */
405 : #define TM50_Clock TM5n_TCL5n_CountClock_Internal3
406 : /*
407 : Value range : 0x00 - 0xff
408 : Pulse cycle = 256 * count_clock
409 : Duty = CR5n_value / 256
410 : */
411 : #define TM50_CR5nValue 0x66
412 :
413 : /* Register settings */
414 : #define TM50_TCL5nValue TM50_Clock /* internal count clock only*/
415 : #define TM50_TMC5nValue TM5n_TMC5n_Operation_Start| TM5n_TMC5n_M
: ode_PWMFreeRunning| /* Value selection
416 : TM5n_TMC5n_OutPut_NoChange
417 : TM5n_TMC5n_OutPut_Clear0
418 : TM5n_TMC5n_OutPut_Set1
419 : */ TM5n_TMC5n_O
: utPut_Clear0| /* Value selection
420 : TM5n_TMC5n_OutPut_NoInversionActiveHigh
421 : TM5n_TMC5n_OutPut_InversionActiveLow
422 : */ TM5n_TMC5n_O
: utPut_InversionActiveLow| TM5n_TMC5n_OutPut_Enable
423 :
424 : /* Interrupt settings */
425 : #define TM50_INTTM50 0
426 :
427 :
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 9
*/
428 : /*
429 : ***************************************
430 : ** TM51 configure
431 : **
432 : ** Please set operation mode here
433 : ***************************************
434 : */
435 : /* if no use set nouse = 1, if use some function set function = 1 */
436 : #define TM51_NotUse 0
437 : #define TM51_Interval 0
438 : #define TM51_ExternalEvent 0
439 : #define TM51_SquareOut 0
440 : #define TM51_PWMOut 1
441 :
442 :
443 : /*
444 : ***************************************
445 : ** TM51 PWM output
446 : **
447 : ** user set cycle = 0.002048s, duty = 80%
448 : ***************************************
449 : */
450 :
451 : /* Count clock and compare value */
452 : /* Use register bit macro
453 : TM5n_TCL5n_CountClock_Internal0 : fprs
454 : TM5n_TCL5n_CountClock_Internal1 : fprs/2
455 : TM5n_TCL5n_CountClock_Internal2 : fprs/2^4
456 : TM5n_TCL5n_CountClock_Internal3 : fprs/2^6
457 : TM5n_TCL5n_CountClock_Internal4 : fprs/2^8
458 : TM5n_TCL5n_CountClock_Internal5 : fprs/2^12
459 : Note : Please select the higher frequency you can,
460 : so the precision will be higher.
461 : */
462 : #define TM51_Clock TM5n_TCL5n_CountClock_Internal3
463 : /*
464 : Value range : 0x00 - 0xff
465 : Pulse cycle = 256 * count_clock
466 : Duty = CR01n_value / 256
467 : */
468 : #define TM51_CR5nValue 0xcc
469 :
470 : /* Register settings */
471 : #define TM51_TCL5nValue TM51_Clock /* internal count clock only*/
472 : #define TM51_TMC5nValue TM5n_TMC5n_Operation_Start| TM5n_TMC5n_M
: ode_PWMFreeRunning| /* Value selection
473 : TM5n_TMC5n_OutPut_NoChange
474 : TM5n_TMC5n_OutPut_Clear0
475 : TM5n_TMC5n_OutPut_Set1
476 : */ TM5n_TMC5n_O
: utPut_Clear0| /* Value selection
477 : TM5n_TMC5n_OutPut_NoInversionActiveHigh
478 : TM5n_TMC5n_OutPut_InversionActiveLow
479 : */ TM5n_TMC5n_O
: utPut_InversionActiveLow| TM5n_TMC5n_OutPut_Enable
480 :
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 10
*/
481 : /* Interrupt settings */
482 : #define TM51_INTTM51 0
483 :
484 :
485 : /*
486 : ***************************************
487 : ** TMH0 configure
488 : **
489 : ** Please set operation mode here
490 : ***************************************
491 : */
492 : /* if no use set nouse = 1, if use some function set function = 1 */
493 : #define TMH0_NotUse 0
494 : #define TMH0_Interval 0
495 : #define TMH0_SquareOut 0
496 : #define TMH0_PWMOut 1
497 :
498 :
499 : /*
500 : ***************************************
501 : ** TMH0 PWM out
502 : **
503 : ** user set cycle = 0.005s, duty = 25%
504 : ***************************************
505 : */
506 :
507 : /* Count clock and compare value */
508 : /* Use register bit macro
509 : TMHn_TMHMDn_CountClock_Internal0 : fprs
510 : TMHn_TMHMDn_CountClock_Internal1 : fprs/2
511 : TMHn_TMHMDn_CountClock_Internal2 : fprs/2^2
512 : TMHn_TMHMDn_CountClock_Internal3 : fprs/2^6
513 : TMHn_TMHMDn_CountClock_Internal4 : fprs/2^10
514 : TMHn_TMHMDn_CountClock_Internal5 : TM50Output
515 : Note : Please select the higher frequency you can,
516 : so the precision will be higher.
517 : */
518 : #define TMH0_Clock TMHn_TMHMDn_CountClock_Internal4
519 : /*
520 : Value range : 0x00 - 0xfe
521 : Pulse cycle = (CMP0n_value + 1) * count_clock
522 : Duty = (CMP1n_value + 1) / (CMP0n_value + 1)
523 : CMP1n_value < CMP0n_value
524 : */
525 : #define TMH0_CMP0nValue 0x26
526 : #define TMH0_CMP1nValue 0x09
527 :
528 : /* Register settings */
529 : #define TMH0_TMHMDnValue TMHn_TMHMDn_Operation_Enable|
: TMH0_Clock| TMHn_TMHMDn_Mode_PWM|
: /* Value selection
530 : TMHn_TMHMDn_Level_Low
531 : TMHn_TMHMDn_Level_High
532 : */
: TMHn_TMHMDn_Level_Low| TMHn_TMHMDn_Output_Enable
533 :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -