STC8A8K64D4 Series Manual
-
SJMP $
END
C language code
#include "reg51.h"
#define PWM0CR (*(unsigned char volatile xdata *)0xff14)
#define PWM1CR (*(unsigned char volatile xdata *)0xff1c)
#define PWM2CR (*(unsigned char volatile xdata *)0xff24)
#define PWM3CR (*(unsigned char volatile xdata *)0xff2c)
#define PWM4CR (*(unsigned char volatile xdata *)0xff34)
#define PWM5CR (*(unsigned char volatile xdata *)0xff3c)
#define PWM6CR (*(unsigned char volatile xdata *)0xff44)
#define PWM7CR (*(unsigned char volatile xdata *)0xff4c)
sfr P_SW2 = 0xba;
sfr P0M1 = 0x93;
sfr P0M0 = 0x94;
sfr P1M1 = 0x91;
sfr P1M0 = 0x92;
sfr P2M1 = 0x95;
sfr P2M0 = 0x96;
sfr P3M1 = 0xb1;
sfr P3M0 = 0xb2;
sfr P4M1 = 0xb3;
sfr P4M0 = 0xb4;
sfr P5M1 = 0xc9;
sfr P5M0 = 0xca;
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
P3M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
P5M1 = 0x00;
P_SW2 = 0x80;
PWM0CR = 0x00; //PWM0/P2.0
// PWM0CR = 0x08; //PWM0_2/P1.0
// PWM0CR = 0x10; //PWM0_3/P6.0
PWM1CR = 0x00; //PWM1/P2.1
// PWM1CR = 0x08; //PWM1_2/P1.1
// PWM1CR = 0x10; //PWM1_3/P6.1
PWM2CR = 0x00; //PWM2/P2.2
// PWM2CR = 0x08; //PWM2_2/P1.2
// PWM2CR = 0x10; //PWM2_3/P6.2
PWM3CR = 0x00; //PWM3/P2.3
// PWM3CR = 0x08; //PWM3_2/P1.3
// PWM3CR = 0x10; //PWM3_3/P6.3