⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f_8_18a_ledsw_a.c

📁 PIC_Hi-Tech_C_Mike_Pearces_I2C_routines Microchi PIC_Hi-Tech C_I2C_for_EEPROM_24LC01B Code
💻 C
字号:
#include "config.h"#include "serial.c"#include "serio.c"#include "delay.h"// this code illustrates a WRONG way to read a switch// for press and release.// Modified from book example so that loop is// exited after 'i' reaches 5, and message// is printed. What will happen is that loop is // exited on first press, as variable i is incremented// while switch is held down. void main(void){  int i;  TRISB = 0xEF;		// set RB4 as output    RB4 = 0;		// turn RB4 off  serial_init(95,1);   // 19200 in HSPLL mode, crystal = 7.3728 MHz   pcrlf();printf ("Press switch when ready!");pcrlf();  i = 0;  // illustrates wrong way to read a switch for presses  while(i < 5) {  // exit loop if i >= 5    if (!RB6) {      i++;      // wrong -- will increment while switch is pressed    }  }  printf("loop exited, i value is: %d\n",i); pcrlf();  while(1);  // loop forever}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -