?? pwmmain.lst
字號:
C51 COMPILER V6.14h PWMMAIN 07/27/2001 03:54:39 PAGE 1
C51 COMPILER V6.14h, COMPILATION OF MODULE PWMMAIN
OBJECT MODULE PLACED IN pwmMain.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE pwmMain.c DEBUG OBJECTEXTEND
stmt level source
1 /*------------------------------------------------------------------------------
2 pwmMain.c : Sample Program that demonstrates the pulse width modulator for the
3 following microcontrollers
4
5 Philips 87LPC768
6
7 Copyright (c) 1988-2001 Keil Elektronik GmbH and Keil Software, Inc.
8 All rights reserved.
9 --------------------------------------------------------------------------*/
10
11 sfr P0 = 0x80;
12 sfr P1 = 0x90;
13 sfr P0M1 = 0x84;
14 sfr P0M2 = 0x85;
15 sfr P1M1 = 0x91;
16 sfr P1M2 = 0x92;
17
18 sfr CNSW0 = 0xD1;
19 sfr CNSW1 = 0xD2;
20 sfr CPSW0 = 0xD3;
21 sfr CPSW1 = 0xD4;
22 sfr CPSW2 = 0xD5;
23 sfr CPSW3 = 0xD6;
24 sfr CPSW4 = 0xD7;
25 sfr PWMCON0 = 0xDA;
26 sfr PWMCON1 = 0xDB;
27
28
29
30 /*------------------------------------------------------------------------------
31 main() : Runs a while loop as the PWM automatically loops
32 ------------------------------------------------------------------------------*/
33 void main( void )
34 {
35 1 CNSW0 = 0xFF; //PWM Clock Count set to Maximum.
36 1 CNSW1 = 0X03;
37 1
38 1 CPSW0 = 0xCC; //Setting duty cycle of channel 0 to 80%
39 1 CPSW1 = 0x98; //Setting duty cycle of channel 1 to 60%
40 1 CPSW2 = 0x64; //Setting duty cycle of channel 2 to 40%
41 1 CPSW3 = 0x30; //Setting duty cycle of channel 3 to 20%
42 1
43 1 CPSW4 = 0xE4; //Setting 8-9 bits of output registers
44 1
45 1 PWMCON0 |= 0x40; //Setting all channels to non-iverted.
46 1
47 1 PWMCON1 &= 0x00; //Braking disabled Shadow Memory transfered.
48 1
49 1 PWMCON0 |= 0x80; //RUN.
50 1
51 1 while(1);
52 1
53 1 }
C51 COMPILER V6.14h PWMMAIN 07/27/2001 03:54:39 PAGE 2
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 32 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -