Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PicoMite e-paper testing/ assistance needed
Author | Message | ||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 357 |
I recently found an e-paper display that I would like to test. The display is PervasiveDisplays E2266JS0C1 2.66".296×152. Black,white and red. I believe it is the same as Waveshare is using in 2.66". Hence I have some hope that Peter' 2018 code would be a good starting point. Loading matherp's old e-paper drivers...but I immediately run into problems. OPTION LCDPANEL USER is not working...Error : Invalid display type I cannot find OPTION LCDPANEL USER in the PicoMite's or other mite's manuals. Suppose this is not a valid command anymore? Tried to search the manuals for guidance, but unfortunately without success. (PicoMite MMBasic Version 5.08.00b4. No options selected yet.) Any suggestions for getting forward with testing? Pluto |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9111 |
Try this PicoMite.zip ' ' ' PicoMite driver for 2.9" e-INK display ' The MMBasic graphics commands update a memory image of the display and the user should call paperREFRESH ' to update the physical display ' Updates take just less than 3 seconds ' ' EPD2IN9 commands Const DRIVER_OUTPUT_CONTROL =&H01 Const BOOSTER_SOFT_START_CONTROL =&H0C Const GATE_SCAN_START_POSITION =&H0F Const DEEP_SLEEP_MODE =&H10 Const DATA_ENTRY_MODE_SETTING =&H11 Const SW_RESET =&H12 Const TEMPERATURE_SENSOR_CONTROL =&H1A Const MASTER_ACTIVATION =&H20 Const DISPLAY_UPDATE_CONTROL_1 =&H21 Const DISPLAY_UPDATE_CONTROL_2 =&H22 Const WRITE_RAM =&H24 Const WRITE_VCOM_REGISTER =&H2C Const WRITE_LUT_REGISTER =&H32 Const SET_DUMMY_LINE_PERIOD =&H3A Const SET_GATE_TIME =&H3B Const BORDER_WAVEFORM_CONTROL =&H3C Const SET_RAM_X_ADD_START_END_POS =&H44 Const SET_RAM_Y_ADD_START_END_POS =&H45 Const SET_RAM_X_ADDRESS_COUNTER =&H4E Const SET_RAM_Y_ADDRESS_COUNTER =&H4F Const TERMINATE_FRAME_READ_WRITE =&HFF Const CE0 = 4 Const DC = 5 Const RST =6 Const BUSY = 7 Dim integer lut_full_update(29)=(2,2,1,&H11,&H12,&H12,&H22,&H22,&H66,&H69,&H69,&H59,&H58,&H99,&H99,&H88,0,0,0,0,&HF8,&HB4,&H13,&H51 , &H35,&H51,&H51,&H19,1,0) ' SetPin gp10,gp11,gp12,spi2 userdisplayinit(0) Line 0,0,MM.HRes-1,MM.VRes-1 Line MM.HRes-1,0,0,MM.VRes-1 Box 0,0,MM.HRes,MM.VRes Text MM.HRes/2,MM.VRes/2,"Driven by PicoMite",CMU,3 paperRefresh End Sub userdisplayinit(wipe As integer) Option explicit Option default none SPI2 open 10000000,0,8 Option LCDPANEL USER, 128,296 'if OPTION is already set then ignore the error 'On error skip Print MM.HRes,MM.VRes 'don't error if Global variables not yet defined 'On error skip 'Erase S$(), tmaskarray(), bmaskarray() Dim S$(MM.VRes-1) length MM.HRes\8 Dim integer bmaskarray(7)=(128,192,224,240,248,252,254,255) Dim integer tmaskarray(7)=(255,127,63,31,15,7,3,1) Local i% Pin(RST)=1 SetPin RST,DOUT Pin(DC)=0 SetPin DC,DOUT Pin(CE0)=1 SetPin CE0,DOUT SetPin BUSY,DIN DO_RESET 'don't error if SPI already open 'On error skip SendCommand(DRIVER_OUTPUT_CONTROL) SendData((MM.VRes - 1) And &HFF) SendData(((MM.VRes - 1) >> 8) And &HFF) SendData(&H00) ' GD = 0; SM = 0; TB = 0; SendCommand(BOOSTER_SOFT_START_CONTROL) SendData(&HD7) SendData(&HD6) SendData(&H9D) SendCommand(WRITE_VCOM_REGISTER) SendData(&HA8); ' VCOM 7C SendCommand(SET_DUMMY_LINE_PERIOD) SendData(&H1A) ' 4 dummy lines per gate SendCommand(SET_GATE_TIME) SendData(&H08) ' 2us per line SendCommand(DATA_ENTRY_MODE_SETTING); SendData(&H03) ' X increment; Y increment sendLUT() For i% = 0 To MM.VRes-1 s$(i%)=String$(MM.HRes\8,Chr$(&HFF)) Next i% If wipe Then 'erase both frame buffers paperRefresh paperRefresh EndIf End Sub ' ' This routine outputs a rectangle to the display. Thi limiting case is a single pixel ' The calling sequence is defined and must be adhered to ' The parameters are the coordinates of one of the extreme diagonals of the rectangle but we don't know which way diagonal. ' Sub MM.USER_RECTANGLE(x1%, y1%, x2%, y2%, fc%) If x1%=0 And y1%=0 And x2%=MM.HRes-1 And y2%=MM.VRes-1 Then Local b$, i% If fc% Then b$=String$(MM.HRes\8,Chr$(0)) Else b$=String$(MM.HRes\8,Chr$(&HFF)) EndIf For i% = 0 To MM.VRes-1 s$(i%)=b$ Next i% Else Local integer i, j, k, l, t, left_x,right_x, mask,emask, fcol% Local b$ If fc%<>0 Then fcol%=0 Else fcol%=1 EndIf 'print "userrectangle ", x1%, y1%, x2%, y2%, fcol% If x2% <= x1% Then t = x1% x1% = x2% x2% = t EndIf If y2% <= y1% Then t = y1% y1% = y2% y2% = t EndIf If x1% < 0 Then x1% = 0 If x1% >= MM.HRes Then x1% = MM.HRes - 1 If x2% < 0 Then x2% = 0 If x2% >= MM.HRes Then x2% = MM.HRes - 1 If y1% < 0 Then y1% = 0 If y1% >= MM.VRes Then y1% = MM.VRes - 1 If y2% < 0 Then y2% = 0 If y2% >= MM.VRes Then y2% = MM.VRes - 1 left_x=x1%\8 right_x=x2%\8 If left_x=right_x Then If (fcol%) Then mask =(tmaskarray(x1% Mod 8) And bmaskarray(x2% Mod 8)) Else mask = notmask%(tmaskarray(x1% Mod 8) And bmaskarray(x2% Mod 8)) EndIf For t=y1% To y2% l= Peek(var S$(t),left_x+1) If (fcol%) Then l=l Or mask Else l=l And mask EndIf Poke var S$(t),left_x+1, l Next t Else If (fcol%) Then mask =tmaskarray(x1% Mod 8) emask=bmaskarray(x2% Mod 8) Else mask = notmask%(tmaskarray(x1% Mod 8)) emask= notmask%(bmaskarray(x2% Mod 8)) EndIf For t=y1% To y2% If fcol% Then l=Peek(var S$(t),left_x+1) l=l Or mask Poke var S$(t),left_x+1, l l=Peek(var S$(t),right_x+1) l=l Or emask Poke var S$(t),right_x+1, l Else l=Peek(var S$(t),left_x+1) l=l And mask Poke var S$(t),left_x+1, l l=Peek(var S$(t),right_x+1) l=l And emask Poke var S$(t),right_x+1, l EndIf Next t If left_x+1<=right_x-1 Then If fcol% Then b$=String$(right_x-left_x-1, Chr$(255)) Else b$=String$(right_x-left_x-1, Chr$(0)) EndIf For t=y1% To y2% s$(t)=Left$(s$(t),left_x+1)+b$+Right$(s$(t),MM.HRes\8-right_x) Next t EndIf EndIf EndIf End Sub ' ' ' ' output a bitmap to the screen ' the bitmap is supplied as a pointer to an area of memory so we use ' peek(byte bitmap%+x) to access the x'th byte in the bitmap ' each byte is a horizontal row of pixels starting with the most significant bit ' e.g. for an 8x8 bitmap ' Byte0Bit7, Byte0Bit6, Byte0Bit5, Byte0Bit4, Byte0Bit3, Byte0Bit2, Byte0Bit1, Byte0Bit0 ' Byte1Bit7, ........., ........., ........., ........., ........., ........., ......... ' Byte2Bit7, ........., ........., ........., ........., ........., ........., ......... ' Byte3Bit7, ........., ........., ........., ........., ........., ........., ......... ' Byte4Bit7, ........., ........., ........., ........., ........., ........., ......... ' Byte5Bit7, ........., ........., ........., ........., ........., ........., ......... ' Byte6Bit7, ........., ........., ........., ........., ........., ........., ......... ' Byte7Bit7, ........., ........., ........., ........., ........., ........., Byte7bit0 ' ' Sub MM.USER_BITMAP(x1%, y1%, width%, height%, scale%, fc%, bc%, bitmap%)'bitmap is in string bitmap$ ' print "userbitmap ", x1%, y1%, width%, height%, scale%, fcol%, bcol% Local INTEGER i, j, k, mask, m, l, ll, t, tt, vCd, hCd, x, y, a%=height% * width%, ln%, c2%, c3%, c4%, fcol%, bcol% If fc%<>0 Then fcol%=0 Else fcol%=1 EndIf If bc%<>0 Then bcol%=0 Else bcol%=1 EndIf vCd = y1% If y1% < 0 Then y1% = 0 ' the y coord is above the top of the screen For i = 0 To height%-1 ' step thru the font scan line by line ln%=i * width% For j = 0 To scale%-1 ' repeat lines to scale the font vCd=vCd+1 If vCd >= 0 Then ' we are above the top of the screen y=vCd - 1 If vCd > MM.VRes Then GoTo D_UP ' we have extended beyond the bottom of the screen hCd = x1% For k = 0 To width%-1 ' step through each bit in a scan line c2%=ln% + k c4%=(a% - c2% - 1) Mod 8 t=Peek(BYTE bitmap% + c2%\8) tt = (t >> c4%) And 1 'we now know if the pixel is on or off For m = 0 To scale% -1 ' repeat pixels to scale in the x axis hCd = hCd +1' we have not reached the left margin If hCd >= 0 Then If hCd <= MM.HRes Then ' check are we beyond the right margin x=hCd -1 mask=1<<(7-(x Mod 8)) c3%=notmask%(mask) ll= Peek(var S$(y),x\8+1) If tt Then If fcol% Then ll = ll Or mask Else ll = ll And c3% EndIf Else If bcol%<>-1 Then 'transparent text If bcol% Then ll = ll Or mask Else ll = ll And c3% EndIf EndIf EndIf Poke var S$(y), x\8+1, ll EndIf EndIf Next m Next k EndIf Next j Next i D_UP: End Sub ' Sub DO_RESET Pin(RST)=0 Pause 200 Pin(RST)=1 Pause 200 End Sub ' Sub WaitUntilIdle Do While(Pin(BUSY)= 1)' 1: busy, 0: idle Pause (100) Loop End Sub ' Sub sendLUT Local integer i SendCommand(WRITE_LUT_REGISTER) 'vcom For i= 0 To 29 SendData(lut_full_update(i)) Next i End Sub ' Sub SendCommand(databyte As integer) Local integer i Pin(CE0)=0 Pin(DC)=0 i=SPI2(databyte) Pin(CE0)=1 End Sub ' Sub SendData(databyte As integer) Local integer i Pin(CE0)=0 Pin(DC)=1 i=SPI2(databyte) Pin(CE0)=1 End Sub ' Sub SetMemoryArea(x_start As integer, y_start As integer, x_end As integer, y_end As integer) { SendCommand(SET_RAM_X_ADD_START_END_POS) '/* x point must be the multiple of 8 or the last 3 bits will be ignored */ SendData((x_start >> 3) And &HFF) SendData((x_end >> 3) And &HFF) SendCommand(SET_RAM_Y_ADD_START_END_POS) SendData(y_start And &HFF) SendData((y_start >> 8) And &HFF) SendData(y_end And &HFF) SendData((y_end >> 8) And &HFF) End Sub ' Sub SetMemoryPointer(x As integer, y As integer) { SendCommand(SET_RAM_X_ADDRESS_COUNTER) '/* x point must be the multiple of 8 or the last 3 bits will be ignored */ SendData((x >> 3) And &HFF) SendCommand(SET_RAM_Y_ADDRESS_COUNTER) SendData(y And &HFF) SendData((y >> 8) And &HFF) WaitUntilIdle() End Sub ' Sub displayframe SendCommand(DISPLAY_UPDATE_CONTROL_2) SendData(&HC4) SendCommand(MASTER_ACTIVATION) SendCommand(TERMINATE_FRAME_READ_WRITE) WaitUntilIdle() End Sub ' Sub paperrefresh Local integer i,j, k, l Timer =0 setmemoryarea(0,0,MM.HRes-1,MM.VRes-1) SetMemoryPointer(0,0) SendCommand(WRITE_RAM) Pin(DC)=1 For i = 0 To MM.VRes-1 k=Peek(varADDR s$(i)) For j=1 To MM.HRes\8 Pin(CE0)=0 l=SPI2(Peek(byte k+j)) Pin(CE0)=1 Next j Next i displayframe End Sub ' Function notmask%(x%) notmask% = (-1 Xor x%) And &HFF End Function Edited 2023-12-08 01:26 by matherp |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 357 |
Thanks matherp! Did not notice your post before now. (Did not expect that fast responce!) Meanwhile I have made my own investigations about the display and concluded that my display does not have the same driver chip as yours. In fact I found a datasheet that I started to work on: 2.66" datasheet PervasiveDisplays 'Testing of e-paper display marked SE2266JS0C1. 'The display is connected to a board with powersupply control and other 'supporting components. 'This program is based on the info from: 'PervasiveDisplays: ApplicationNote_Small_Size_Mono_v02_220606.pdf 'Fred Nissfolk 7.12.2023 PIN(GP5)=0 setpin GP5,DOUT 'Reset PIN(GP6)=0 setpin GP6,DOUT 'D/C selects between Data and Commands PIN(GP7)=1 setpin GP7,DOUT 'CS chip select SETPIN GP4,DIN 'BUSY PIN(GP8)=1 'power setpin GP8,DOUT 'Power: P-FET controls Power ON /OFF to DC/DC converter. SETPIN GP0,GP3,GP2,SPI 'MISO,MOSI,CLK spi open 100000,0,8 dim as integer Comm,dat,i 'PervasiveDisplays: ApplicationNote_Small_Size_Mono_v02_220606.pdf 'Power on COG driver p.17 of 25 ?"power on COG" pin(GP8)=0 '0=ON, 1=OFF pause 5 PIN(GP5)=1 'Reset=1 pause 5 PIN(GP5)=0 'reset=0 pause 10 PIN(GP5)=1 'Reset=1 pause 5 SendCommand(&h00) SendData(h0E) pause 5 '3. Set environment temperature and PSR p.18 ?"Set environment temperature" SendCommand (&hE5) 'Input temperature SendData(21) 'Ambient temperature 'Active Temperature ?"Active Temperature" SendCommand(&hE0) SendData(&h02) 'Panel Settings ?"Panel settings" SendCommand(&h00) SendData(&hCF) 'Size: Other size than 2.9", 3.7”, 4.2”, 4.37” SendData(&h89) 'Size: Other size than 2.9", 3.7”, 4.2”, 4.37” 'Input image to the EPD 'The data of image frame, one bit represents 1 pixel. (e.g. the first byte 'represents the 1st ~ 8th pixels of the first line, the second byte represents 'the 9th ~ 16th pixels of the first line, …… and so on). 'For 2.66" with 152x296 pixels the nbr of bytes is 152*296/8=5624 ?"Input image frame 1" SendCommand(&h10) 'Send to first frame For i=1 to 5624/4 'fill the first 1/4 with black pixels SendData(&hFF) next i For i=5624*3/4+1 to 5624 'Fill 3/4 with white SendData(&h00) next i ?"Input image frame 2" SendCommand(&h13) 'Send to second frame For i=1 to 5624*3/4 'No red pixels on the first 3/4 SendData(&h00) next i For i=5624/4+1 to 5624 'Red pixels on the last 1/4 SendData(&hFF) next i 'Should remain a white area between Black and Red. Yes it does! 'pin(GP8)=1 '0=ON, 1=OFF '5. Send updating command p21 ?"send updating command" DO WHILE PIN(GP4)=0 ' GP4=0 means BUSY. Wait until not busy. print "Loop1" loop ?"Power ON" SendCommand(&h04) 'Power on command do WHILE PIN(GP4)=0 print "Loop2" loop ?"Display refresh" SendCommand(&h12) 'Display Refresh do WHILE PIN(GP4)=0 'print "Loop3" loop '5. Turn-off DC/DC p.22 ?"turn off DC/DC" SendCommand(&h02) 'Turn off DC/DC do 'print "Loop4" loop until PIN(GP4)=1 'Set RES to floating SETPIN GP5,DIN 'Clear CS, SDIN and SCLK to low level spi close pin(GP7)=0 setpin GP3,dout pin(GP3)=0 SETPIN GP2,dout PIN(GP2)=0 'Cut off the Vcc/Vdd of COG PIN(GP8)=1 'Set BUSY pin to output 0 setpin GP4, DOUT pin(GP4)=0 'Set RES pin back to output 0 from floating SETPIN GP5,DOUT pin(GP5)=0 END '*********** SUBs********** SUB SendCommand comm as integer 'sub SendCommand 'sends command ?"comm=";comm local integer i PIN(GP7)=0 'CS PIN(GP6)=0 'D/C i=SPI(comm) PIN(GP7)=1 'CS PIN(GP6)=1 'D/C end sub SUB SendData dat as integer local integer i PIN(GP7)=0 'CS i=spi(dat) PIN(GP7)=1 'CS end sub > option list PicoMite MMBasic Version 5.08.00b4 OPTION FLASH SIZE 4194304 I have now managed to fill areas of the display with Black, White and Red. Not very useful, but at least some kind of starting point. Thanks! Pluto |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 357 |
Maybe not the most elegant way to use the e-paper... Step 1: Display the text/graphics on ILI9341 LCD in Black, White and Red Step 2: Extract the black pixels from LCD into an array Step 3: Extract the red pixels from LCD into an other array Step 4: Send the arrays to the e-paper. LCD: e-paper: 'Testing of e-paper display marked SE2266JS0C1. 'The display is connected to a board with powersupply control and other 'supporting components. 'This program is based on the info from: 'PervasiveDisplays: ApplicationNote_Small_Size_Mono_v02_220606.pdf 'Fred Nissfolk 7.12.2023, 18.12.2023 ' 'COMMAND BYTES: '&hE5 input of ambient temperature '&hE0 activate temperature '&h00 Panel settings '&h10 First frame of display data - BLACK '&h13 Second frame - RED '&h04 Power on command '&h12 Display refresh '&h02 Turn-off DC/DC converter ' 'Using an ILI9341 LCD for creating the screen to be displayed on e-paper. 'Read the pixel information from the LCD into two arrays, first for black and 'then for red pixels. Using the color=PIXEL(x,y) function. 'Pins used for the e-paper. SPI2 for e-paper, SYSTEM SPI for LCD. PIN(GP5)=0 setpin GP5,DOUT 'Reset PIN(GP6)=0 setpin GP6,DOUT 'D/C selects between Data and Commands PIN(GP7)=1 setpin GP7,DOUT 'CS chip select SETPIN GP4,DIN 'BUSY PIN(GP8)=1 'power OFF setpin GP8,DOUT 'Power: P-FET controls Power ON /OFF to DC/DC converter. SETPIN GP28,GP27,GP26,SPI2 'MISO,MOSI,CLK (SPI2 for e-paper) spi2 open 20000000,0,8 dim as integer Comm,dat,i,BlackArray(5625),RedArray(5625) 'PervasiveDisplays: ApplicationNote_Small_Size_Mono_v02_220606.pdf 'Power on COG driver p.17 of 25 ?"power on COG" pin(GP8)=0 '0=ON, 1=OFF pause 5 PIN(GP5)=1 'Reset=1 pause 5 PIN(GP5)=0 'reset=0 pause 10 PIN(GP5)=1 'Reset=1 pause 5 SendCommand(&h00) SendData(h0E) pause 5 '3. Set environment temperature and PSR p.18 ?"Set environment temperature" SendCommand (&hE5) 'Input temperature SendData(21) 'Ambient temperature 'Active Temperature ?"Active Temperature" SendCommand(&hE0) SendData(&h02) 'Panel Settings ?"Panel settings" SendCommand(&h00) SendData(&hCF) 'Size: Other size than 2.9", 3.7", 4.2", 4.37" SendData(&h89) 'Size: Other size than 2.9", 3.7", 4.2", 4.37" '******************************************************* '** TEXT AND GRAPHICS TO BE DISPLAYED ***************** CLS RGB(White) 'clear LCD with WHITE background BOX 1,1,296,152,5,rgb(red) BOX 10,130,20,10,,rgb(Black),RGB(Black) BOX 100,130,20,10,,rgb(RED),RGB(RED) BOX 200,130,20,10,,rgb(RED),RGB(BLACK) TEXT 10,25,"SE2266JS0C1","LM",4,2,rgb(black),RGB(white) TEXT 10,60,"HELLO","LM",5,1,rgb(black),RGB(white) TEXT 150,60,"18 December 2023","LM",1,1,rgb(white),RGB(red) TEXT 10,90,"PicoMite","LM",5,1,rgb(RED),RGB(white) TEXT 210,90,"e-paper","LM",4,1,rgb(White),RGB(BLACK) '******************************************************** '******************************************************** BlackPixFromLCD 'read the black pixels from LCD's 152*296 area RedPixFromLCD 'read the red pixels 'Input image to the EPD 'The data of image frame, one bit represents 1 pixel. (e.g. the first byte 'represents the 1st ~ 8th pixels of the first line, the second byte represents 'the 9th ~ 16th pixels of the first line, ?? and so on). 'For 2.66" with 152x296 pixels the nbr of bytes is 152*296/8=5624 ?"Input image frame 1 to e-paper" SendCommand(&h10) 'Command: Send to first frame For i=1 to 5624 SendData(BlackArray(i)) 'Send BLACK pixels NEXT i ?"Input image frame 2 to e-paper" SendCommand(&h13) 'Command: Send to second frame For i=1 to 5624 SendData(RedArray(i)) 'Send RED pixels NEXT i 'Send updating command p21 ?"send updating command" DO WHILE PIN(GP4)=0 ' GP4=0 means BUSY. Wait until not busy. 'print "Loop1" loop ?"Power ON" SendCommand(&h04) 'Power on command do WHILE PIN(GP4)=0 'print "Loop2" loop ?"Display refresh" SendCommand(&h12) 'Display Refresh do WHILE PIN(GP4)=0 'print "Loop3" loop 'Turn-off DC/DC p.22 ?"turn off DC/DC" SendCommand(&h02) 'Turn off DC/DC do 'print "Loop4" loop until PIN(GP4)=1 'Set RES to floating SETPIN GP5,DIN 'Clear CS, SDIN and SCLK to low level spi2 close pin(GP7)=0 setpin GP3,dout pin(GP3)=0 SETPIN GP2,dout PIN(GP2)=0 'Cut off the Vcc/Vdd of COG PIN(GP8)=1 'Set BUSY pin to output 0 setpin GP4, DOUT pin(GP4)=0 PAUSE 150 'Set RES pin back to output 0 from floating SETPIN GP5,DOUT pin(GP5)=0 PIN(GP8)=1 'power OFF (external P-FET). 1=OFF, 0=ON END '*********** SUBs********** SUB SendCommand comm as integer 'sub SendCommand 'sends command ?"comm=";comm local integer i PIN(GP7)=0 'CS PIN(GP6)=0 'D/C i=SPI2(comm) PIN(GP7)=1 'CS PIN(GP6)=1 'D/C end sub SUB SendData dat as integer local integer i PIN(GP7)=0 'CS 'pause 0.01 i=spi2(dat) 'Pause 0.01 PIN(GP7)=1 'CS end sub sub BlackPixFromLCD 'epaper is 152*296 pixels. 44992 pixels in total 'pixels grouped in bytes of 8 pixels =>5624 bytes 'epaper width is 152px = 19 bytes 'epaper height is 296px = 296 rows ?"Reading BLACK pixels from LCD" idx=1 For row=1 to 296 '296 for x=1 to 152 step 8 dataByte=0 For bit=7 to 0 step -1 BLK=0 IF PIXEL(row,152-(x+7-bit))=0 then BLK=1 IF bit>0 then DataByte=DataByte+BLK<<1 IF bit=0 THEN DataByte=DataByte+BLK next bit '?bin$(DataByte,8); BlackArray(idx)=DataByte idx=idx+1 next x '?"next row" Next row END SUB sub RedPixFromLCD 'epaper is 152*296 pixels. 44992 pixels in total 'pixels grouped in bytes of 8 pixels =>5624 bytes 'epaper width is 152px = 19 bytes 'epaper height is 296px = 296 rows ?"Reading RED pixels from LCD" idx=1 For row=1 to 296 '296 for x=1 to 152 step 8 dataByte=0 For bit=7 to 0 step -1 cRED=0 IF PIXEL(row,152-(x+7-bit))=&hFC0000 then cRED=1 IF bit>0 then DataByte=DataByte+cRED<<1 IF bit=0 THEN DataByte=DataByte+cRED next bit '?bin$(DataByte,8); RedArray(idx)=DataByte idx=idx+1 next x '?"next row" Next row END SUB > option list PicoMite MMBasic Version 5.08.00b4 OPTION SYSTEM SPI GP18,GP19,GP16 OPTION FLASH SIZE 4194304 OPTION CPUSPEED 378000 'KHz OPTION LCDPANEL ILI9341, LANDSCAPE,GP15,GP14,GP13 OPTION TOUCH GP12,GP11 GUI CALIBRATE 0, 3882, 3934, -825, -649 Black/Red/White graphics can also easily be displayed, once you get it displayed on the LCD. Pluto |
||||
Kawamarad Newbie Joined: 29/01/2024 Location: CanadaPosts: 8 |
Hello, Is there is a driver for the "Waveshare 4.2 inch e-paper module (400x300 pixels)"? I tried my luck with the 2.9 inch driver, but nothing happened... I own a 2.9 inch module, and the corresponding driver works just fine! Emmanuel. "Écrire des messages en majuscules accélère le traitement informatique" (ChatGPT) |
||||
guma1975 Newbie Joined: 13/01/2023 Location: PolandPosts: 7 |
Hello and welcome. I tried to connect a 2.9-inch waveshare and try the driver as in the first post... But it turned out that I had version v2 296x128 or 128x296. Is there any possibility for v2 to work? When I looked at v2, there are a lot of differences, but since I'm new to this wonderful Picomite software, I'm slowly giving up... Can you tell me where and what to change? From what I've gathered, the initialization is probably different and due to the handling of gray levels, it's very complicated for me... I'm trying to understand what this lut_full is, but I'm probably rusty because I'm from 1975... hihi... Regards and warmest regards thank you in advance for any help... PS... Sorry for my English, but it's because of the translator.... From what I saw on the 1054z oscilloscope, the pins work correctly.... Here is a photo of this display from the back. From the front it looks the same as in the first post. I thought it was damaged but I managed to find a ready-made uf2 demo for pico and upload it from github and it works... But luckily, I don't know C, and for me, basic is still manageable in play at this age... I am attaching photos of the finished uf2 from github... Thank you all for such a beautiful gift in the form of picomite and for your contribution to this project. For me it's something beautiful - you can touch BASIC with such powerful functions. Best regards again. rubber1975. |
||||
Print this page |