Oto moje doświadczenie z SeeedStudio E-Ink.
http://www.picaxeforum.co.uk/showthread.php?23583-E-ink-on-PICAXE-see-it-now- !
Atrament Seeedstudio E to tarcza kompatybilna z Arduino. (Jednak nie jest w pełni kompatybilny z Arduino!. Zobacz Forum Seeedstudio: http://www.seeedstudio.com/forum/viewtopic.php?p=16432#p16432 )
Oto kod PICAXE:
#PICAXE 28X2
Eeprom %00001111, ( %00000000 ) ' %00000000
Eeprom %00011111, ( %11000000 ) ' %11000000
Eeprom %00101111, ( %00110000 ) ' %00110000
Eeprom %00111111, ( %11110000 ) ' %11110000
Eeprom %01001111, ( %00001100 ) ' %00001100
Eeprom %01011111, ( %11001100 ) ' %11001100
Eeprom %01101111, ( %00111100 ) ' %00111100
Eeprom %01111111, ( %11111100 ) ' %11111100
Eeprom %10001111, ( %00000011 ) ' %00000011
Eeprom %10011111, ( %11000011 ) ' %11000011
Eeprom %10101111, ( %00110011 ) ' %00110011
Eeprom %10111111, ( %11110011 ) ' %11110011
Eeprom %11001111, ( %00001111 ) ' %00001111
Eeprom %11011111, ( %11001111 ) ' %11001111
Eeprom %11101111, ( %00111111 ) ' %00111111
Eeprom %11110000, ( %00000000 ) ' %00000000
Eeprom %11110001, ( %11000000 ) ' %11000000
Eeprom %11110010, ( %00110000 ) ' %00110000
Eeprom %11110011, ( %11110000 ) ' %11110000
Eeprom %11110100, ( %00001100 ) ' %00001100
Eeprom %11110101, ( %11001100 ) ' %11001100
Eeprom %11110110, ( %00111100 ) ' %00111100
Eeprom %11110111, ( %11111100 ) ' %11111100
Eeprom %11111000, ( %00000011 ) ' %00000011
Eeprom %11111001, ( %11000011 ) ' %11000011
Eeprom %11111010, ( %00110011 ) ' %00110011
Eeprom %11111011, ( %11110011 ) ' %11110011
Eeprom %11111100, ( %00001111 ) ' %00001111
Eeprom %11111101, ( %11001111 ) ' %11001111
Eeprom %11111110, ( %00111111 ) ' %00111111
Eeprom %11111111, ( %11111111 ) ' %11111111
pause 5000
sertxd ("Eink_8",cr,lf)
setfreq m16
Symbol Eink_CS1 = S.6 ' Chip select for Eink driver
Symbol Eink_DC = S.5 ' Data/Command control for Eink driver
Symbol GT_CS2 = S.4 ' Chip select for character ROM
Symbol i = w4
Symbol Xs = b10
Symbol Xe = b11
Symbol Ys = b12
Symbol Ye = b13
Symbol Char = b14
Symbol Char16 = w8
Symbol Char16Lo = b16
Symbol Char16Hi = b17
Symbol CommandByte = b18
Symbol DataByte = b19
Symbol t = b20
HIGH Eink_CS1
HIGH Eink_DC
HIGH GT_CS2
hspisetup spimode00e, spimedium
sertxd ("hspisetup done",cr,lf)
Gosub initEink
sertxd ("init done",cr,lf)
Gosub clearScreen
sertxd ("clear done",cr,lf)
Ys = 170
Xs = 2 : Ys = 179
for t = 0 to 13
lookup t, ( "PICAXE RULES !" ),Char
Ys = Ys - 8 : Gosub displayChar
next
sertxd ("line 1 done",cr,lf)
Xs = 7 : Ys = 179
for t = 0 to 20
lookup t, ( "Eink from Seeedstudio" ),Char
Ys = Ys - 8 : Gosub displayChar
next
sertxd ("line 2 done",cr,lf)
Xs = 12 : Ys = 179
for t = 0 to 18
lookup t, ( "Cheers, from Buzby." ),Char
Ys = Ys - 8 : Gosub displayChar
next
sertxd ("line 3 done",cr,lf)
Gosub refreshScreen
sertxd ("refreshScreen done",cr,lf)
sertxd ( "Done",cr,lf )
End
' =================================================================
writeComm:
LOW Eink_DC
LOW Eink_CS1
hspiout ( CommandByte )
HIGH Eink_CS1
return
' =================================================================
writeData:
HIGH Eink_DC
LOW Eink_CS1
hspiout ( DataByte )
HIGH Eink_CS1
return
' =================================================================
clearScreen:
CommandByte = 0x24 : Gosub writeComm
HIGH Eink_DC
LOW Eink_CS1
For i = 0 to 3095
hspiout (0xFF)
Next i
HIGH Eink_CS1
Pause 1000
return
' =================================================================
initEink:
CommandByte = 0x10 : Gosub writeComm ' exit deep sleep mode
DataByte = 0x00 : Gosub writeData
CommandByte = 0x11 : Gosub writeComm ' data enter mode
DataByte = 0x03 : Gosub writeData
CommandByte = 0x44 : Gosub writeComm ' set RAM x address start/end, in page 36
DataByte = 0x00 : Gosub writeData ' RAM x address start at 00h;
DataByte = 0x11 : Gosub writeData ' RAM x address end at 11h(17)->72: [because 1F(31)->128 and 12(18)->76]
CommandByte = 0x45 : Gosub writeComm ' set RAM y address start/end, in page 37
DataByte = 0x00 : Gosub writeData ' RAM y address start at 00h;
DataByte = 0xAB : Gosub writeData ' RAM y address start at ABh(171)->172: [because B3(179)->180]
CommandByte = 0x4E : Gosub writeComm ' set RAM x address count to 0
DataByte = 0x00 : Gosub writeData
CommandByte = 0x4F : Gosub writeComm ' set RAM y address count to 0
DataByte = 0x00 : Gosub writeData
CommandByte = 0xF0 : Gosub writeComm ' booster feedback used, in page 37
DataByte = 0x1F : Gosub writeData
CommandByte = 0x22 : Gosub writeComm ' display updata sequence option ,in page 33
Databyte = 0xC0 : Gosub writeData ' enable sequence: clk -> CP
Gosub configureLUTRegister
CommandByte = 0x2C : Gosub writeComm ' vcom
DataByte = 0xA0 : Gosub writeData
CommandByte = 0x3C : Gosub writeComm ' board
DataByte = 0x63 : Gosub writeData
CommandByte = 0x22 : Gosub writeComm ' display updata sequence option ,in page 33
DataByte = 0xC4 : Gosub writeData ' enable sequence: clk -> CP -> LUT -> initial display -> pattern display
return
' =================================================================
configureLUTRegister:
CommandByte = 0x32 : Gosub writeComm ' write data to LUT register
HIGH Eink_DC
LOW Eink_CS1
hspiout ( 0x00,0x00,0x00,0x55,0x00,0x00,0x55,0x55,0x00,0x55, _
0x55,0x55,0xAA,0xAA,0xAA,0xAA,0x15,0x15,0x15,0x15, _
0x05,0x05,0x05,0x05,0x01,0x01,0x01,0x01,0x00,0x00, _
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, _
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, _
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, _
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, _
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, _
0x22,0xFB,0x22,0x1B,0x00,0x00,0x00,0x00,0x00,0x00 )
HIGH Eink_CS1
return
' =================================================================
refreshScreen:
CommandByte = 0x20 : Gosub writeComm
Gosub closeBump
Pause 2000
return
' =================================================================
closeBump:
CommandByte = 0x22 : Gosub writeComm
DataByte = 0x03 : Gosub writeData
CommandByte = 0x20 : Gosub writeComm
return
' =================================================================
#rem
Xs --> X start address 0~17
Xe --> X end address 0~17
Ys --> Y start address 0~171
Ye --> Y end address 0~171
#endrem
setPositionXY:
LOW Eink_CS1
LOW Eink_DC
hspiout ( 0x44 )' set RAM x address start/end command
HIGH Eink_DC
hspiout ( Xs , Xe )
LOW Eink_DC
hspiout ( 0x45 )' set RAM y address start/end command
HIGH Eink_DC
hspiout ( Ys , Ye )
LOW Eink_DC
hspiout ( 0x4E )' set RAM x address count to Xs
HIGH Eink_DC
hspiout ( Xs )
LOW Eink_DC
hspiout ( 0x4F )' set RAM y address count to Ys
HIGH Eink_DC
hspiout ( Ys )
HIGH Eink_CS1
return
' =================================================================
#rem
display character in the Eink screen:
x:the X start address,X value can be 0 to 14;
y:the Y start address, Y vlue can be 171 to 7;
the charater diplay erea is from x to x+3 in X position and from y to y-7 in Y position
unicode_char:the character machine code
*/
void E_ink::displayChar(INT8U x,INT8U y,INT16U unicode_Char)
{
INT16U i;
getCharMatrixData(unicode_Char);
converCharMatrixData();
setPositionXY(x,x+3,y,y-7);
writeComm(0x11); /*data enter mode command */
writeData(0x05); /*set Y-mode:X address is increment and y address decrement */
writeComm(0x24);
for(i=0;i<32;i++)
{
writeData(matrixdata_conver[i]);
}
}
#endrem
displayChar:
' Make address of character in ROM
Char16 = Char - 0x20 * 16
' Reset scratchpad pointer
ptr = 0
' Get 16 bytes character data from ROM into scratchpad
LOW GT_CS2
hspiout (0x03,0,Char16Hi,Char16Lo)
hspiin (@ptrinc, @ptrinc, @ptrinc, @ptrinc,@ptrinc, @ptrinc, @ptrinc, @ptrinc, _
@ptrinc, @ptrinc, @ptrinc, @ptrinc,@ptrinc, @ptrinc, @ptrinc, @ptrinc )
HIGH GT_CS2
#rem
sertxd ("chardata",cr,lf)
ptr = 0
sertxd (Char, " ", #@ptrinc,",", #@ptrinc,",", #@ptrinc,",", #@ptrinc,",",#@ptrinc,",", #@ptrinc,",", #@ptrinc,",", #@ptrinc,",", _
#@ptrinc,",", #@ptrinc,",", #@ptrinc,",", #@ptrinc,",",#@ptrinc,",", #@ptrinc,",", #@ptrinc,",", #@ptrinc, cr, lf )
for ptr = 0 to 15
b0 = @ptr
sertxd (#bit7,#bit6,#bit5,#bit4,#bit3,#bit2,#bit1,#bit0,cr,lf)
next
#endrem
' Convert data bytes into twos
for i = 0 to 7
ptr = i ' Get single byte
b0 = @ptr
' original in b0, result in w0 - Thanks to hippy !
b1 = b0 | $0F : Read b1, b1
b0 = b0 | $F0 : Read b0, b0
ptr = i + 16 : @ptr = inv b0
ptr = i + 24 : @ptr = inv b1
next i
for i = 8 to 15
ptr = i ' Get single byte
b0 = @ptr
' original in b0, result in w0 - Thanks to hippy !
b1 = b0 | $0F : Read b1, b1
b0 = b0 | $F0 : Read b0, b0
ptr = i + 24 : @ptr = inv b0
ptr = i + 32 : @ptr = inv b1
next i
Xe = Xs + 3
Ye = Ys - 7
Gosub setPositionXY
CommandByte = 0x11 : Gosub writeComm ' /*data enter mode command */
DataByte = 0x05 : Gosub writeData ' /*set Y-mode:X address is increment and y address decrement */
CommandByte = 0x24 : Gosub writeComm
HIGH Eink_DC
LOW Eink_CS1
for ptr = 16 to 47
hspiout (@ptr)
next
HIGH Eink_CS1
return
Na tarczy są tak naprawdę tylko dwa aktywne układy, ROM postaci i sterownik e-atramentu.
Kod odczytuje ROM, aby uzyskać wzorce bitów, ponownie rozmieszcza bity, a następnie wysyła do sterownika E-ink.
Nie mogłem znaleźć nazwy producenta na samym wyświetlaczu E-ink, chyba że producent nazywa się „Dobry wyświetlacz”! (Są to jedyne słowa na odwrocie i numer części GDE021A1) (EDYCJA: Właśnie ponownie przejrzałem numer części i tym razem znalazłem producenta. To dobry wyświetlacz!)
Uważam, że jest to idealne rozwiązanie dla właściwej aplikacji, po prostu muszę ją znaleźć.