?? pwm.c
字號:
/* *File: Pwm.c *Purpose: Initialize the PWM(Pulse Width Modulation) Module
* *Notes: Assume that thers is a LED linked to the output pins */#define MCF5272_PWM_PWMCR1 (0x0C0)#define MCF5272_PWM_PWWD1 (0x0d0)#define MCF5272_MBAR 0x10000000#include <stdio.h>main(){ if( getchar() == '1') { //disable the pwm,and output is low *(volatile unsigned char *)(MCF5272_MBAR + MCF5272_PWM_PWMCR1) = 0x04; usleep(2000000); //disable the pwm,and output is high *(volatile unsigned char *)(MCF5272_MBAR + MCF5272_PWM_PWMCR1) = 0x24; }else { //enable the pwm,and output is half high *(volatile unsigned char *)(MCF5272_MBAR + MCF5272_PWM_PWWD1) = 0x80; *(volatile unsigned char *)(MCF5272_MBAR + MCF5272_PWM_PWMCR1) = 0xA0; } printf("OK\n"); }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -