PCBWay 3rd PCB Design Contest
VOTE NOW!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Design 1/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Usability 2/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Creativity 3/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Content 4/4

database for pic arduino and arm microntroller



code


#include <Wire.h>   

 

#define disk1 0x50   

 

void setup(void)

{

 Serial.begin(9600);

 Wire.begin();  

 

 unsigned int address = 0;

 

 writeEEPROM(disk1, address, 26);

 Serial.print("Echo from EEPROM 24C02 for adress 0x00: ");

 Serial.print(readEEPROM(disk1, address), DEC);

}

 

void loop(){}

 

void writeEEPROM(int deviceaddress, unsigned int eeaddress, byte data ) 

{

 Wire.beginTransmission(deviceaddress);

 Wire.write((int)(eeaddress >> 8));  

 Wire.write((int)(eeaddress & 0xFF));

 Wire.write(data);

 Wire.endTransmission();

 

 delay(5);

}

 

byte readEEPROM(int deviceaddress, unsigned int eeaddress ) 

{

 byte rdata = 0xFF;

 

 Wire.beginTransmission(deviceaddress);

 Wire.write((int)(eeaddress >> 8));  

 Wire.write((int)(eeaddress & 0xFF)); 

 Wire.endTransmission();

 

 Wire.requestFrom(deviceaddress,1);

 

 if (Wire.available()) rdata = Wire.read();

 

 return rdata;

}

May 14,2019
201 viewsReport item
  • Comments(0)
  • Likes(1)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
    View More