Skip to content

Instantly share code, notes, and snippets.

@TheSkorm
Created May 5, 2015 12:27
Show Gist options
  • Select an option

  • Save TheSkorm/0ff0d8ba41703e99314d to your computer and use it in GitHub Desktop.

Select an option

Save TheSkorm/0ff0d8ba41703e99314d to your computer and use it in GitHub Desktop.
hackish eeprom reader - may or may not work
void setup() {
// put your setup code here, to run once:
// port
// port l = data
// port c = address 8-13
// port a = address 0-7
DDRL = B00000000;
DDRC = B11111111;
DDRA = B11111111;
Serial.begin(115200);
PORTA=0;
PORTC=0;
}
void loop() {
if (PORTC <= B00111111){
printHex(PINL,2);
if((PORTA%16) == 0 ){
Serial.println();
}
if (PORTA == 255){
PORTA=0;
PORTC++;
}
else {
PORTA++;
}
delay(1);
}
}
void printHex(int num, int precision) {
char tmp[16];
char format[128];
sprintf(format, "%%.%dX", precision);
sprintf(tmp, format, num);
Serial.print(tmp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment