#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
}
//未完成