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

📄 f_14_15_eetst.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"#include "ee_module.c"#define BUFSIZE 64unsigned char buf[BUFSIZE];void main(void){  unsigned char c, cnt, addr,mode, *s;  serial_init(95,1); // 19200 in HSPLL mode, crystal = 7.3728 MHz  addr = 0;  pcrlf();  printf("PIC18 On-board EEPROM R/W Test");  pcrlf();  while(1){    pcrlf();    printf("Enter 'w' for write mode, else read: ");    c=getche();  pcrlf();    if (c != mode) addr=0; //reset address    mode = c;    if (mode == 'w') {      printf("Enter string, %d chars max: ",BUFSIZE);      pcrlf();      s = buf; cnt = 0;      do { // get a string	c = getche();	if (c != 0x0D) {	  *s = c; s++; cnt++;	}      }while(c != 0x0D);      *s = 0; s++;cnt++;      pcrlf();      if (eedata_writestr(buf,addr)) {	printf("Write unsuccessful!"); pcrlf();      }      addr = addr + cnt;    } else {      // read a string from EEPROM      addr = eedata_readstr(buf,addr,BUFSIZE);      printf("String read: %s",buf);      pcrlf();    }  }}                    

⌨️ 快捷键说明

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