#define _SYNC 0x00 #define _BLACK 0x01 #define _GRAY 0x02 #define _WHITE 0x03 #define _LONG_SYNC 19 #define _SHORT_SYNC 2 #define _LONG_SYNC_DELAI 2 #define _SHORT_SYNC_DELAI 30 #define _NB_PIXELS 29 #define _NB_LIGNES 19 #define _COMPENS_BOUCLE 7 #define _COMPENS_IF_SERIAL 17 byte memVideo[_NB_PIXELS][_NB_LIGNES]; byte index, index2; byte shift; void SPI_MasterInit(void) { /* Set MOSI and SCK output, all others input */ DDRD = (1<>4]; PORTB = PORTB; PORTB = PORTB; } delayMicroseconds(2); // 4 uS PORTB = _BLACK; PORTB = _BLACK; PORTB = _BLACK; PORTB = _BLACK; PORTB = _BLACK; PORTB = _BLACK; PORTB = _BLACK; PORTB = _BLACK; PORTB = _BLACK; } // SYNC VERT B // ligne 310 LONG SYNC PORTB = _SYNC; delayMicroseconds(_SHORT_SYNC); PORTB = _BLACK; delayMicroseconds(_SHORT_SYNC_DELAI); PORTB = _SYNC; delayMicroseconds(_SHORT_SYNC); PORTB = _BLACK; delayMicroseconds(_SHORT_SYNC_DELAI); // ligne 311 SHORT SYNC PORTB = _SYNC; delayMicroseconds(_SHORT_SYNC); PORTB = _BLACK; delayMicroseconds(_SHORT_SYNC_DELAI); PORTB = _SYNC; delayMicroseconds(_SHORT_SYNC); PORTB = _BLACK; delayMicroseconds(_SHORT_SYNC_DELAI); // ligne 312 SHORT SYNC PORTB = _SYNC; delayMicroseconds(_SHORT_SYNC); PORTB = _BLACK; delayMicroseconds(_SHORT_SYNC_DELAI); PORTB = _SYNC; delayMicroseconds(_SHORT_SYNC); PORTB = _BLACK; delayMicroseconds(_SHORT_SYNC_DELAI-_COMPENS_BOUCLE-_COMPENS_IF_SERIAL); if (Serial.available()) { c = Serial.read (); switch (c) { case '4' : if (cx>0) cx--; break; case '6' : if (cx<29) cx++; break; case '8' : if (cy>0) cy--; break; case '2' : if (cy<18) cy++; break; case '5' : memVideo[cx][cy] = couleur; break; case 'n' : couleur = _BLACK; break; case 'g' : couleur = _GRAY; break; case 'b' : couleur = _WHITE; break; } } }