s5pc100裸奔全攻略之pwm timer

作者:赵孝强

以下是s5pc100的不带系统pwm timer的程序,需要map.lds,Makefile,s5pc100,文件,用v7交叉工具链,以上文件可在www.farsight.com.cn下载到。

#include "s5pc100.h"
        void pwm_init()
        {
                GPD.GPDCON = GPD.GPDCON & (~0XF0) | (0X2<<4);        //set gpiod timer out mode
                CLK_GATE_D1.CLK_GATE_D1_3 = CLK_GATE_D1.CLK_GATE_D1_3 | (1<<6);        //Gating PCLK for PWM Pass
                TIMER.TCFG0 = ( TIMER.TCFG0 & ~0XFF ) + 0xff;
                TIMER.TCFG1 = ( TIMER.TCFG1 & ~0Xf0 ) + 3<<4;
                TIMER1.TCNTB1 = 3000;
                TIMER1.TCMPB1 = 2500;
                TIMER.TCON = 0X0e<<8;
                TIMER.TCON = 0X0d<<8;
        }
        int main()
        {
                pwm_init();
                while(1);

}

你可能感兴趣的:(嵌入式,程序,工具,华清远见,讲师)