Sorry, ich hatte zuerst den falschen Post verlinkt und dies erst nach 1 Minute korrigiert.
Ich wollte auch den zusammenhängenden Thread verlinken, damit's klarer wird.
Also hier nochmals der sketch
// Gameking cart reader ino sketch by Gamekin. Mostly snippets from other sources
//1 game carts have 17 Adress lines (128 K), 4in1 carts 20. So need to read up to 1 MB
//Some pin functions are unknown or unsure. So can only use CE, not OE. And use 3V.
//No RAM no EEPROMs just 1 ROM. 3x74HC595, so I think I have to read 3 Bytes each loop.
//changed. multicarts obviously only 512 KB. But I first try to read 1 game for time reasons of poor slot
#include "pins_arduino.h"
//taken from Atariromreader unknown if needed
//Pin connected to ST_CP of 74HC595
int latchPin = 10; //Latch, SS ? might be changed, but ProMini has limited pins
//Pin connected to SH_CP of 74HC595
int clockPin = 13; //SCK
////Pin connected to DS of 74HC595
int dataPin = 11; // MOSI
int d0Pin = 2; //necessary ? most don't have this, but I have wired this
int d1Pin = 3;
int d2Pin = 4;
int d3Pin = 5;
int d4Pin = 6;
int d5Pin = 7;
int d6Pin = 8;
int d7Pin = 9;
//Arduino ProMini has internal pull-up resistors, also for data lines. Unsure if I should use them.
//digitalWrite(d0Pin, HIGH); d0-7, digitalWrite(irqPin, HIGH); would activate them
// I have external resistors and 3.3V Arduino and cart
//a buffer for bytes to burn
#define ROM_SIZE 133120
// in bytes. 512 KB or 1MB , but for now read a bit more than 1 game=128 KB+2
// byte buffer[ROM_SIZE]; -used by other sketch. Overflow in arry dimension error with this value
int data = 0; //Used in counting up to the ROM's maximum byte
byte myByte = 0x00; // Used later as D0-D7 byte
//unknown if need more definitions like irqPin. What about CE (at the 74HC595) and SRCLR? physically tied to GND/VCC
void setup(){
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT); // ---one code says INPUT here, but maybe later
}
//taken from MEEPROMMER or other projects
void data_bus_input() {
pinMode(d0Pin, INPUT);
pinMode(d1Pin, INPUT);
pinMode(d2Pin, INPUT);
pinMode(d3Pin, INPUT);
pinMode(d4Pin, INPUT);
pinMode(d5Pin, INPUT);
pinMode(d6Pin, INPUT);
pinMode(d7Pin, INPUT);
}
//switch IO lines of databus to OUTPUT state. --- Unknown why input and output. EEPROM write? or combined ADR and Data lines for SegaGen
void data_bus_output() {
pinMode(d0Pin, OUTPUT);
pinMode(d1Pin, OUTPUT);
pinMode(d2Pin, OUTPUT);
pinMode(d3Pin, OUTPUT);
pinMode(d4Pin, OUTPUT);
pinMode(d5Pin, OUTPUT);
pinMode(d6Pin, OUTPUT);
pinMode(d7Pin, OUTPUT);
}
//set databus to input and read a complete byte from the bus
//be sure to set data_bus to input before --- do I have to write to the data_bus?
byte read_data_bus(){
Serial.begin(57600); //max 57600 for atmega328p, unknown if FTDI drivers needs other than serial, unsure if serial.begin before pinmode
}
void loop() {
while (Serial.available() <=0){
delay (200);
}
//for (int i=0; i<24; i++){ // 3x8 bits ?? first attempt from other sketch
//void shiftOut24bit(int clockPin, int latchPin, int dataPin, unsigned long value) { //taken from sgcexplorer
//digitalWrite(latchPin, LOW);
//shiftOut(dataPin, clockPin, MSBFIRST, (value & 0x00FF0000) >> 16);
//shiftOut(dataPin, clockPin, MSBFIRST, (value & 0x0000FF00) >> 8);
//shiftOut(dataPin, clockPin, MSBFIRST, (value & 0x000000FF));
//digitalWrite(latchPin, HIGH);
digitalWrite(latchPin, LOW); //make shift reg listen
if (data < ROM_SIZE) { //Do I need to open a file and filename before?
shiftOut(dataPin, clockPin, MSBFIRST, (data >> 16)); //read 3 Bytes and shift. binary output?
shiftOut(dataPin, clockPin, MSBFIRST, data >> 8);
shiftOut(dataPin, clockPin, MSBFIRST, data);
digitalWrite(latchPin, HIGH);
delay(5);
myByte = d7Pin //originally called myDigitalRead (9), data pin 9-2 , taken from AtariRomread
| d6Pin <<1
| d5Pin <<2
| d4Pin <<3
| d3Pin <<4
| d2Pin <<5
| d1Pin <<6
| d0Pin <<7;
Serial.write(myByte);
data++;
delay (5);
//digitalWrite(latchPin, LOW);
}
}
Die Thematik ist eigentlich ein simples lesen eines (EEP)ROMS.
Alle Pins sind leider nicht exakt bekannt, insbesondere nicht OE. Im englischen Forum meinte man, CE reicht.
Ich mache die ganze Sache auch nicht für mich alleine.
Wie lange meine Sockelkonstruktion hält kann ich nicht sagen.
Daher suche ich jemanden, der sich kurzfristig mal den Code angucken kann und mir Tipps geben kann.
Vielleicht nur ne Kleinigkeit die ich oben vergessen hab.
Gibts da nicht irgendein kurzes Testprogramm für den Serial Monitor (per FTDI)?
Das Problem liegt wohl schon am Anfang oder bei der Einstellung.