📄 timer_a.lst
字号:
422 /**************************************************************************/
423 void near timer_a1_init_timer_mode (void)
424 {
\ 000098 EC80 PUSHM R0
425 TA1MR = 0x80; // XX0X XX00
\ 00009A 74CF9703 MOV.B #128,919
\ 80
426 // |||| |||+- must always be 0 in timer mode
427 // |||| ||+-- must always be 0 in timer mode
428 // |||| |+--- 0: pulse is not output at pin TA1out
429 // |||| | 1: pulse is output at pin TA1out
430 // |||| | TA1out is automatically output
431 // |||| +---- 0: gate function: timer counts only
432 // |||| when TA1in is held "L"
433 // |||| 1: gate function: timer counts only
434 // |||| when TA1in is held "H"
435 // |||+------ 0: gate function not available
436 // ||| 1: gate function available
437 // ||+------- must always be 0 in timer mode
438 // |+-------- count source selection bits:
439 // +--------- count source selection bits
440 // 00: f1
441 // 01: f8
442 // 10: f32
443 // 11: fc32
444
445 // Clock prescaler reset flag
446 // This function is only effective if fc32 is selected
447 if ((TA1MR & 0xC0)==0xC0)
\ 00009F 74C0C0 MOV.B #192,R0L
\ 0000A2 139703 AND.B 919,R0L
\ 0000A5 7680C0 CMP.B #192,R0L
\ 0000A8 6E06 JNE ?0007
\ ?0006:
448 {
449 CPSRF = 0x80; // 1--- ----
\ 0000AA 74CF8103 MOV.B #128,897
\ 80
\ ?0007:
450 // +---------- 1: clock prescaler is reset
451 }
452 }
\ 0000AF ED01 POPM R0
\ 0000B1 F3 RTS
\ timer_a1_init_event_counter_mode:
453
454 /**************************************************************************/
455 /* */
456 /* Timer A1 - Initialization for event counter mode */
457 /* The timer counts pulses from an external source or another */
458 /* timer's overflow. */
459 /* routine may be customized to the user's needs */
460 /* */
461 /* Name : timer_a1_init_event_counter_mode */
462 /* Date/Author : 08.04.1997/ST */
463 /* Parameter : */
464 /* Return : */
465 /* */
466 /**************************************************************************/
467 void near timer_a1_init_event_counter_mode (void)
468 {
469 TA1MR = 0x01; // -X0X XX01
\ 0000B2 C7019703 MOV.B #1,919
470 // |||| |||+- must always be 1 in event counter mode
471 // |||| ||+-- must always be 0 in event counter mode
472 // |||| |+--- 0: pulse is not output at pin TA1out
473 // |||| | 1: pulse is output at pin TA1out at
474 // |||| | overflow/underflow
475 // |||| | TA1out is automatically output
476 // |||| +---- 0: counts ext. signal's falling edge
477 // |||| 1: counts ext. signal's rising edge
478 // |||| valid only if ext. trigger signal is
479 // |||| selected by event/trigger select bit
480 // |||+------ 0: counts up or down according to UDF
481 // ||| UDF bit 0 : downcount activated
482 // ||| UDF bit 1 : upcount activated
483 // ||| 1: counts up or down according to
484 // ||| TA1out input signal
485 // ||| TA1out "L": downcount activated
486 // ||| TA1out "H": upcount activated
487 // ||| TA1out must configured as input
488 // ||+------- must always be 0 in event counter mode
489 // |+-------- 0: count operation reload type
490 // | 1: count operation free-run type
491 // +--------- invalid in event counter mode
492
493 UDF &= ~(0x02); // ---- --X-
\ 0000B6 97FD8403 AND.B #253,900
494 // +- 0: timer A1 down count
495 // 1: timer A1 up count
496
497 TRGSR &= ~(0x01); // ---- --XX
\ 0000BA 97FE8303 AND.B #254,899
498 TRGSR |= 0x02; // |+- timer A1 event/trigger select bits
\ 0000BE 9F028303 OR.B #2,899
499 // +-- timer A1 event/trigger select bits
500 // 00: input on TA1in (TA1in must be input)
501 // 01: overflow of timer B2
502 // 10: overflow of timer A0
503 // 11: overflow of timer A2
504
505 }
\ 0000C2 F3 RTS
\ timer_a1_init_one_shot_timer_mode:
506
507 /**************************************************************************/
508 /* */
509 /* Timer A1 - Initialization for one shot timer mode */
510 /* The timer counts once */
511 /* routine may be customized to the user's needs */
512 /* */
513 /* Name : timer_a1_init_one_shot_timer_mode */
514 /* Date/Author : 08.04.1997/ST */
515 /* Parameter : */
516 /* Return : */
517 /* */
518 /**************************************************************************/
519 void near timer_a1_init_one_shot_timer_mode (void)
520 {
\ 0000C3 EC80 PUSHM R0
521 TA1MR = 0xD2; // XX0X XX10
\ 0000C5 74CF9703 MOV.B #210,919
\ D2
522 // |||| |||+- must always be 0 in one-shot timer mode
523 // |||| ||+-- must always be 1 in one-shot timer mode
524 // |||| |+--- 0: pulse is not output at pin TA1out
525 // |||| | 1: pulse is output at pin TA1out
526 // |||| | TA1out is automatically output
527 // |||| +---- 0: ext. trigger falling edge of
528 // |||| TA1in input signal
529 // |||| 1: ext. trigger rising edge of
530 // |||| TA1in input signal
531 // |||| TA1in must be configured as input
532 // |||| TA1in must be selected by
533 // |||| event/trigger select bit
534 // |||+------ 0: trigger is one-shot start flag (ONSF)
535 // ||| 1: trigger is selected by event/trigger
536 // ||| select bits
537 // ||+------- must always be 0 in one-shot timer mode
538 // |+-------- count source select bits
539 // +--------- count source select bits
540 // 00: f1
541 // 01: f8
542 // 10: f32
543 // 11: fc32
544
545 ONSF &= ~(0x02); // ---- --0-
\ 0000CA 97FD8203 AND.B #253,898
546 // +-- timer A1 one-shot start flag
547
548 TRGSR &= ~(0x01); // ---- --XX
\ 0000CE 97FE8303 AND.B #254,899
549 TRGSR |= 0x02; // |+- timer A1 event/trigger select bits
\ 0000D2 9F028303 OR.B #2,899
550 // +-- timer A1 event/trigger select bits
551 // 00: input on TA1in (TA1in must be input)
552 // 01: overflow of timer B2
553 // 10: overflow of timer A0
554 // 11: overflow of timer A2
555
556 // Clock prescaler reset flag
557 // This function is only effective if fc32 is selected
558 if ((TA1MR & 0xC0)==0xC0)
\ 0000D6 74C0C0 MOV.B #192,R0L
\ 0000D9 139703 AND.B 919,R0L
\ 0000DC 7680C0 CMP.B #192,R0L
\ 0000DF 6E06 JNE ?0009
\ ?0008:
559 {
560 CPSRF = 0x80; // 1--- ----
\ 0000E1 74CF8103 MOV.B #128,897
\ 80
\ ?0009:
561 // +---------- 1: clock prescaler is reset
562 }
563 }
\ 0000E6 ED01 POPM R0
\ 0000E8 F3 RTS
\ timer_a1_init_pwm_mode:
564
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -