STC 设置端口电平并编写驱动-流水灯(1)

#include <reg32.h>

sbit led = P1^0;   //set the port bit

void main(void)

{

    led = 1;     //or led=0; set the port voltage_level

}

+----------------------------------------------------------------------------------------------------------------------------------------+

We can text wen led = 1, the port p10 set at hight voltage_leval;

If we want to delay it, make it output like the push-pull type;

we shoule add the delay function, Layout delay_function onto main_function,and able to run.

+-------------------------------------------------------------------------------------------------------------------------------------------------------------+

#define uint unsigned int   //difinition the uint type

void delay(uint num)

{

 uint x,y;

 for(x=num; x>0; x--)

  for(y=110; y>0; y++)

}

#=========================================================================================#

This is a floating_light program to apply the stc_bits_set and push-pul_type_output

#include <reg.h>

#define uchar unsigned char

#define uint unsigned int

sbit P1

void delay(uint num)

{

  uint x,y;

  for(x=num; x>0; x--)

  for(y=110; y>0; y++)

}

void main(void)

{

    led = 1;     //or led=0; set the port voltage_level

}

//未完成

 

上一篇:关于 STC(时空上下文) 跟踪算法的理解


下一篇:LOJ 121 「离线可过」动态图连通性——LCT维护删除时间最大生成树