//晟矽微单片机编程第七天
//qq:74145445
//快手:共同学习stm8
/**************************************************/
// MC32P7311
// _____@_____
// led11--p16|1 16|p17--anjian
// vdd|2 15|vss
// led10--p15|3 14|p00--led0
// led9--p14|4 13|p01--led1
// led8--p13|5 12|p02--led5
// led7--p12|6 11|p03--led4
// led6--p11|7 10|p04--led3
// ad --p10|8_________9|p05--led2
/**************************************************/
#define bit0 0b00000001
#define bit1 0b00000010
#define bit2 0b00000100
#define bit3 0b00001000
#define bit4 0b00010000
#define bit5 0b00100000
#define bit6 0b01000000
#define bit7 0b10000000
#define bit8 0b0000000100000000
#define bit9 0b0000001000000000
#define bit10 0b0000010000000000
#define bit11 0b0000100000000000
#define bit12 0b0001000000000000
#define bit13 0b0010000000000000
#define bit14 0b0100000000000000
#define bit15 0b1000000000000000
/**************************************************/
//led0--p00
#define led0_chu P00OE=1
#define led0_h P00D=1
#define led0_l P00D=0
//led1--p01
#define led1_chu P01OE=1
#define led1_h P01D=1
#define led1_l P01D=0
//led2--p05
#define led2_chu P05OE=1
#define led2_h P05D=1
#define led2_l P05D=0
//led3--p04
#define led3_chu P04OE=1
#define led3_h P04D=1
#define led3_l P04D=0
//led4--p03
#define led4_chu P03OE=1
#define led4_h P03D=1
#define led4_l P03D=0
//led5--p02
#define led5_chu P02OE=1
#define led5_h P02D=1
#define led5_l P02D=0
//led6--p11
#define led6_chu P11OE=1
#define led6_h P11D=1
#define led6_l P11D=0
//led7--p12
#define led7_chu P12OE=1
#define led7_h P12D=1
#define led7_l P12D=0
//led8--p13
#define led8_chu P13OE=1
#define led8_h P13D=1
#define led8_l P13D=0
//led9--p14
#define led9_chu P14OE=1
#define led9_h P14D=1
#define led9_l P14D=0
//led10--p15
#define led10_chu P15OE=1
#define led10_h P15D=1
#define led10_l P15D=0
//led11--p16
#define led11_chu P16OE=1
#define led11_h P16D=1
#define led11_l P16D=0
/**************************************************/
#include"MC32P7311.h"
void yanshi(); //延时
void main()
{
led0_chu;
led1_chu;
led2_chu;
led3_chu;
led4_chu;
led5_chu;
led6_chu;
led7_chu;
led8_chu;
led9_chu;
led10_chu;
led11_chu;
for(;;)
{
led0_h; yanshi();
led1_h; yanshi();
led2_h; yanshi();
led3_h; yanshi();
led4_h; yanshi();
led5_h; yanshi();
led6_h; yanshi();
led7_h; yanshi();
led8_h; yanshi();
led9_h; yanshi();
led10_h; yanshi();
led11_h; yanshi();
led0_l; yanshi();
led1_l; yanshi();
led2_l; yanshi();
led3_l; yanshi();
led4_l; yanshi();
led5_l; yanshi();
led6_l; yanshi();
led7_l; yanshi();
led8_l; yanshi();
led9_l; yanshi();
led10_l; yanshi();
led11_l; yanshi();
}
}
/**************************************************/
void yanshi() //延时
{
unsigned int x;
for(x=1000;x>0;x--)
{
;;;;;;;;;;;
;;;;;;;;;;;
;;;;;;;;;;;
;;;;;;;;;;;
}
}
/**************************************************/
/**************************************************/
|