- /**************************************************/
- #include <ny8l.h>
- /**************************************************/
- #define led_l PA&=~(1<<2)
- #define led_h PA|=(1<<2)
- #define anjian PA&(1<<6)
- /**************************************************/
- void yanshi(); //延时
- /**************************************************/
- void main(void)
- {
- /**************************************************/
- PAIO &=~(1<<2); //1输入,0输出
- PAC |=(1<<2); //1输出,0开漏
- /**************************************************/
- PAIO |=(1<<6); //1输入,0输出
- PAC |=(1<<6); //1.100K,0.1M
- /**************************************************/
- while(1)
- {
- //CLRWDT();
- if(anjian){led_h;} else{led_l;}
- yanshi(); //延时
- }
- }
- /**************************************************/
- /**************************************************/
- void yanshi() //延时
- {
- unsigned char z1,z2;
- for(z1=50;z1>0;z1--)
- for(z2=120;z2>0;z2--);
- }
- /**************************************************/
- /**************************************************/
|