Epson S1D13708 Camera Accessories User Manual


 
Epson Research and Development Page 17
Vancouver Design Center
Connecting to a Micro-Controller via the Indirect Interface S1D13708
Issue Date: 01/12/12 X39A-G-020-01
The following is a C implementation of the bus cycles:
// these are the simplified mode 68 bus cycles to mimic on the PIC general IO pins
#define CommandWriteStep1 0b10010100 // A0= low, RW=low
#define CommandWriteStep2 0b10011000 // CS=low, EBL= high
#define CommandWriteStep3 0b10010100 // EBL= low,CS=high
#define CommandWriteStep4 0b10110110 // a0= high, rw=high
#define DataWriteStep1 0b10010110 // rw=low
#define DataWriteStep2 0b10011010 // cs=low,ebl=high
#define DataWriteStep3 0b10010110 // cs=high,ebl=low
#define DataWriteStep4 0b10110110 // rw=high
#define DataReadStep1 0b10111010 // c78NORMAL & ~c78CS | c78EBL; CS=low, EBL= high
////////////////////////////////////////////////////////////////////////////
// routine to mimic a mode 68 command write cycle
//
void command_write (char command_value)
{
// command write cycle
PORTB= command_value; // place the register onto the data bus
TRISB= 0; // make port as output
LATD= CommandWriteStep1;
LATD= CommandWriteStep2;
Nop();
Nop();
Nop();
Nop();
Nop();
LATD= CommandWriteStep3;
LATD= CommandWriteStep4;
LATD= c78NORMAL;
TRISB= 0xff; // set bus as Inputs
}
////////////////////////////////////////////////////////////////////////////
// routine to mimic a mode 68 data write cycle
//
void data_write (char data_value)
{
PORTB= data_value; // place the register onto the data bus
TRISB= 0; // make port as output
LATD= DataWriteStep1;
LATD= DataWriteStep2;
Nop();
Nop();
Nop();
Nop();
Nop();
LATD= DataWriteStep3;
LATD= DataWriteStep4;
LATD= c78NORMAL; // back to original state
TRISB= 0xff; // set bus as Inputs
}
////////////////////////////////////////////////////////////////////////////
// routine to mimic a mode 68 data read cycle
//
char return_data_read;
char data_read (void)
{
TRISB= 0xff; // make port as output
LATD= DataReadStep1;
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
return_data_read= PORTB; // place the register onto the data bus
LATD= c78NORMAL; // we can terminate cycle early for speed
return return_data_read;
}