C51算术运算符练习
时间:11-11
来源:互联网
点击:
/*
*位定义实现3个LED的点亮
*李钦焰2011.12.01
*/
#include
#defineON 0
#defineOFF 1
sbit led1=P1^0;
sbit led2=P1^2;
sbit led3=P1^5;
main()
{
bit a;
a=ON;
led1=led2=led3=a;
while(1);
}
/*
* char变量的用法
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0x55;
P1=led;
while(1);
}
/*
* *的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0x00+1*8;
P1=led;
while(1);
}
/*
*复合赋值运算符的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
#define led6(1<6)
main()
{
/*unchar led = 0;
led |= led6 ;//置位
*/
unchar led=0xff;
led&=~led6;
P1=led;
while(1);
}
/*
* +的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0x00+0xE0;
P1=led;
while(1);
}
/*
* %的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=66%5;
P1=led;
while(1);
}
/*
* <的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0xFF>>3;
P1=led;
while(1);
}
/*
* &的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0x55&0xAA;
P1=led;
while(1);
}
*位定义实现3个LED的点亮
*李钦焰2011.12.01
*/
#include
#defineON 0
#defineOFF 1
sbit led1=P1^0;
sbit led2=P1^2;
sbit led3=P1^5;
main()
{
bit a;
a=ON;
led1=led2=led3=a;
while(1);
}
/*
* char变量的用法
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0x55;
P1=led;
while(1);
}
/*
* *的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0x00+1*8;
P1=led;
while(1);
}
/*
*复合赋值运算符的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
#define led6(1<6)
main()
{
/*unchar led = 0;
led |= led6 ;//置位
*/
unchar led=0xff;
led&=~led6;
P1=led;
while(1);
}
/*
* +的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0x00+0xE0;
P1=led;
while(1);
}
/*
* %的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=66%5;
P1=led;
while(1);
}
/*
* <的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0xFF>>3;
P1=led;
while(1);
}
/*
* &的使用
*李钦焰
* 2011.12.01
*/
#include
#define uncharunsigned char
main()
{
unchar led;
led=0x55&0xAA;
P1=led;
while(1);
}
C51算术运算 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)