最新三星单片机应用

9488定时器应用示例

Published:2010.10.13 NewsFrom:ZHANHENG TECHNOLOGY(HK)CO.,LTD/SHENZHEN ZHANHENGLONG ELECTRONIC CO,LTD Views:
//9488定时器B功能测试
;9488定时器B功能测试B:DAMI调试通过:
;9488 8位定时器B的使用
;有关的I/O为三个:TBPWM(输出)(P1.0)

;有关的寄存器:
;TBCON
;TBDATAH,TBDATAL
;TINTPND(中断待决,标志产生了哪个中断(如果EA=1,就会产生中断)),
;TACON的配置时钟选择,模式,中断允许,启动定时器,清计数器.

;模式有:间隔定时功能,PWM模式
;有定时中断:定时器B溢出中断

        .INCLUDE"S3C9488.REG"
        VECTOR 00H,F9488_INT
        .ORG 003CH
        DB 0FFH
        DB 0FFH
        DB 01100000B
        DB 00000011B
        .ORG 100H
        DI
        LD WDTCON,#10101010B
        LD BTCON,#00001011B ;跟TIMEA/B没关系
        LDCLKCON,#00011000B;时钟控制器不分频

        LD SP,#0C0H
        LD SYM,#0
        LD OSCCON,#0
        ;LD OSCCON,#11110110b ;主从晶体及运行/停止
LD P1CONL,#00000001B ;P1CONH.1~P3CONH.0=01
        LD TBDATAL,#200
        LD TBDATAH,#20 ;TBDATAL/TBDATAH用于PWM调节高电平/低电平宽度(TBCON.5~4=10)
        LD TBCON,#11101111B ;TBCON.5~4=10
        ;LD TBCON,#11001111B ;TBCON.5~4=00,01时 PWM宽度调节与相应的TBDATAL/TBDATAH有关,
        
        EI
        LD R1,#0
MAIN:
        NOP
        NOP
        
        JP MAIN
F9488_INT:
        TM TINTPND,#4
        JP TB_OV_INT
        
        IRET
TB_OV_INT:
        LD TINTPND,#0
        INC R1
        NOP
        NOP
        IRET
        .END
Development tools for MCU
Programming console for MCU
Development tools for ARM
the C compiler
Contact
Samsung SCM:

ic168@zh-ic.COM

Development Tools:

B6078S@163.com

Site suggestions:

zh-ic@163.com

  Service
 MSN