Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 19:16 29 Apr 2024 Privacy Policy
Jump to

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 : Micromite MK2 graphic library and drivers

     Page 2 of 2    
Author Message
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 04:47pm 24 Nov 2014
Copy link to clipboard 
Print this post

Tracked down where the issue is coming from but now I'm not sure if this is caused by a firmware bug - I am using B23.

In the dChar sub the following line is causing the issue (of blank characters):
character=getchar(ch) 'loads the character

The 'character' integer always returns a zero even though the getchar(ch) returns a correct (non-zero) value.

So if I add PRINT getchar(ch) before the above line; a non-zero value is correctly displayed (so the sub getchar(ch) is working fine).
If I add PRINT character after the above line then it reruns 0 every time (not getting loaded correctly).

Anyone got any ideas???

I will try a different variable name instead of Character - maybe that may help . . .

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8584
Posted: 11:48pm 24 Nov 2014
Copy link to clipboard 
Print this post

WhiteWizzard

Please substitute the attached font cFunction as the original has some misplaced characters. This isn't related to your problem though. This new version has been tested on b24 which I don't think has been generally distributed yet. Try setting "OPTION DEFAULT INTEGER" rather than FLOAT and make sure there are no spaces between any function definitions and the opening bracket of the argument list, any spaces cause the function type to be ignored. This should give an error and Geoff is aware of the problem. "FUNCTION test(a as integer) as integer" works "FUNCTION test (a as integer) as integer" doesn't. I'm based in Saffron Walden just south of Cambridge.

best regards

Peter

CFunction font
00000000
00000000 00000000 4f5b3e00 00003e5b 4f6b3e00 00003e6b 7c3e1c00 00001c3e
7e3c1800 0000183c 7d571c00 00001c57 7f5e1c00 00001c5e 3c180000 00000018
c3e7ff00 0000ffe7 24180000 00000018 dbe7ff00 0000ffe7 3a060e00 00003048
79292600 00002629 05050700 0000407f 05253f00 0000407f e73c5a00 00005a3c
1c1c0800 00007f3e 1c3e7f00 0000081c 7f221400 00001422 005f5f00 00005f5f
7f017f00 00000609 89956a00 00000066 60606000 00006060 ffa29400 000094a2
7e040800 00000804 7e201000 00001020 2a1c0800 00000808 2a080800 0000081c
10101000 00001e10 0c1e0c00 00000c1e 3e383000 00003038 3e0e0600 0000060e
00000000 00000000 5f000000 00000000 00070000 00000007 147f1400 0000147f
7f2a1200 0000242a 08646200 00002313 56205000 00003649 07030000 00000008
22410000 0000001c 221c0000 00000041 7f1c2a00 00002a1c 3e080800 00000808
70300000 00000080 08080800 00000808 60600000 00000000 08040200 00002010
49453e00 00003e51 7f400000 00000042 49494600 00007249 494d3300 00002141
127f1000 00001814 45453900 00002745 49493100 00003c4a 11090700 00004121
49493600 00003649 49291e00 00004649 14000000 00000000 34000000 00000040
14224100 00000008 14141400 00001414 22140800 00000041 59090600 00000201
5d594e00 00003e41 11127c00 00007c12 49493600 00007f49 41412200 00003e41
41413e00 00007f41 49494100 00007f49 09090100 00007f09 41517300 00003e41
08087f00 00007f08 7f410000 00000041 413f0100 00002040 14224100 00007f08
40404000 00007f40 1c027f00 00007f02 08107f00 00007f04 41413e00 00003e41
09090600 00007f09 51215e00 00003e41 19294600 00007f09 49493200 00002649
7f010300 00000301 40403f00 00003f40 40201f00 00001f20 38403f00 00003f40
08146300 00006314 78040300 00000304 494d4300 00006159 41414100 0000007f
08102000 00000204 41417f00 00000041 01020400 00000402 40404000 00004040
07080000 00000003 54784000 00002054 44443800 00007f28 44442800 00003844
44287f00 00003844 54541800 00003854 7e090200 00000008 a49c7800 000018a4
04047800 00007f08 7d400000 00000044 403d0000 00002040 28440000 00007f10
7f400000 00000041 78047800 00007c04 04047800 00007c08 44443800 00003844
24241800 0000fc18 2418fc00 00001824 04040800 00007c08 54542400 00004854
3f442400 00000404 40207c00 00003c40 40201c00 00001c20 30403c00 00003c40
10284400 00004428 90907c00 00004c90 544c4400 00004464 36410000 00000008
77000000 00000000 36080000 00000041 02040200 00000201 23263c00 00003c26
a1611200 00001ea1 40207a00 00003a40 54555900 00003854 55794100 00002155
54784200 00002254 54784000 00002155 55794000 00002054 52721200 00000c1e
55555900 00003955 54545900 00003954 54545800 00003955 457c4100 00000000
457d4200 00000002 457c4000 00000001 11127d00 00007d12 2528f000 0000f028
55450000 00007c54 547c5400 00002054 097f4900 00007c0a 49493200 00003249
44443a00 00003a44 48483000 0000324a 41217a00 00003a41 40207800 00003a42
a0a07d00 0000009d 42423d00 00003d42 40403d00 00003d40 ff242400 00003c24
49436600 0000487e fc2f2b00 00002b2f 29f62000 0000ff09 7e090300 0000c088
54794100 00002054 447d4100 00000000 484a3200 00003048 40227a00 00003840
0a0a7200 0000007a 19317d00 00007d0d 292f2800 00002629 29292600 00002629
4d402000 00003048 08080800 00003808 08083800 00000808 c8acba00 00002f10
2834fa00 00002f10 7b000000 00000000 2a142200 00000814 2a140800 00002214
5500aa00 0000aa00 aa55aa00 0000aa55 00ff0000 00000000 10ff0000 00001010
14ff0000 00001414 ff00ff00 00001010 f010f000 00001010 14fc0000 00001414
f700ff00 00001414 ff00ff00 00000000 f404fc00 00001414 17101f00 00001414
1f101f00 00001010 141f0000 00001414 10f00000 00001010 001f1000 00000000
101f1000 00001010 10f01000 00001010 00ff1000 00000000 10101000 00001010
10ff1000 00001010 00ff1400 00000000 ff00ff00 00000000 1f101700 00000000
fc04f400 00000000 17101700 00001414 f404f400 00001414 ff00f700 00000000
14141400 00001414 f700f700 00001414 14171400 00001414 1f101f00 00001010
14f41400 00001414 f010f000 00001010 1f101f00 00000000 001f1400 00000000
00fc1400 00000000 f010f000 00000000 ff10ff00 00001010 14ff1400 00001414
101f0000 00001010 00f01000 00000000 ffffff00 0000ffff f0f0f000 0000f0f0
ff000000 0000ffff 00ffff00 00000000 0f0f0f00 00000f0f 44384400 00003844
4a4a3400 0000fc4a 02060600 00007e02 027e0200 0000027e 49416300 00006355
443c0400 00003844 201e2000 0000407e 7e020200 00000602 e7a59900 000099a5
492a1c00 00001c2a 01724c00 00004c72 4d4d3000 0000304a 78483000 00003048
5a463d00 0000bc62 49490000 00003e49 01017e00 00007e01 2a2a2a00 00002a2a
5f444400 00004444 4a444000 00004051 4a514000 00004044 ff010300 00000000
ff000000 0000e080 6b6b0800 00000808 36243600 00003612 090f0600 0000060f
18180000 00000000 10100000 00000000 ff010100 00003040 01011e00 0000001f
1d171200 00000019 3c3c3c00 0000003c 00000000 00000000
End CFunction
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 12:19am 25 Nov 2014
Copy link to clipboard 
Print this post

Thanks Peter - will try that code in a while (hopefully this will display the 'space' character as a space - I was getting a'shape' instead' which caused my flashing text not to flash in effect!)

I sorted a workaround in the early hours this morning. I loaded a new global variable with the value in getchar in the Getchar function (pbsr=Getchar); and then populated the 'character' integer with the value stored in the new global variable in the dChar sub (character=pbsr).
I will try your suggestion to see if this makes the original code work.

Will update later with results . . .
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 12:44am 25 Nov 2014
Copy link to clipboard 
Print this post

Peter,

The new CFuntion FONT code sorts out the 'space character' issue - Thanks.

However, tried your other suggestions to get the text to display but it still leaves the value of zero in the 'character' variable resulting in no text outputted. Resorted back to my workaround so at least I can explore the OLED's capabilities.

Many, many thanks for this code - BIG HELP

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 02:22pm 25 Nov 2014
Copy link to clipboard 
Print this post

@WW

when you run the following program
OPTION EXPLICIT
OPTION DEFAULT INTEGER

DIM AddrOfFont
DIM Index
DIM BitMap

AddrOfFont=PEEK(CFunAddr FONT)

Index=5

BitMap=GetChar(Index)

PRINT HEX$(BitMap,16)

END

FUNCTION GetChar(char AS integer) AS integer
LOCAL AS integer i=char<<3
Getchar=PEEK(WORD AddrOfFont+i)+(PEEK(WORD AddrOfFont+i+4)<<32)
END FUNCTION

CFUNCTION font
00000000
00000000 00000000 4f5b3e00 00003e5b 4f6b3e00 00003e6b 7c3e1c00 00001c3e
7e3c1800 0000183c 7d571c00 00001c57 7f5e1c00 00001c5e 3c180000 00000018
c3e7ff00 0000ffe7 24180000 00000018 dbe7ff00 0000ffe7 3a060e00 00003048
79292600 00002629 05050700 0000407f 05253f00 0000407f e73c5a00 00005a3c
1c1c0800 00007f3e 1c3e7f00 0000081c 7f221400 00001422 005f5f00 00005f5f
7f017f00 00000609 89956a00 00000066 60606000 00006060 ffa29400 000094a2
7e040800 00000804 7e201000 00001020 2a1c0800 00000808 2a080800 0000081c
10101000 00001e10 0c1e0c00 00000c1e 3e383000 00003038 3e0e0600 0000060e
00000000 00000000 5f000000 00000000 00070000 00000007 147f1400 0000147f
7f2a1200 0000242a 08646200 00002313 56205000 00003649 07030000 00000008
22410000 0000001c 221c0000 00000041 7f1c2a00 00002a1c 3e080800 00000808
70300000 00000080 08080800 00000808 60600000 00000000 08040200 00002010
49453e00 00003e51 7f400000 00000042 49494600 00007249 494d3300 00002141
127f1000 00001814 45453900 00002745 49493100 00003c4a 11090700 00004121
49493600 00003649 49291e00 00004649 14000000 00000000 34000000 00000040
14224100 00000008 14141400 00001414 22140800 00000041 59090600 00000201
5d594e00 00003e41 11127c00 00007c12 49493600 00007f49 41412200 00003e41
41413e00 00007f41 49494100 00007f49 09090100 00007f09 41517300 00003e41
08087f00 00007f08 7f410000 00000041 413f0100 00002040 14224100 00007f08
40404000 00007f40 1c027f00 00007f02 08107f00 00007f04 41413e00 00003e41
09090600 00007f09 51215e00 00003e41 19294600 00007f09 49493200 00002649
7f010300 00000301 40403f00 00003f40 40201f00 00001f20 38403f00 00003f40
08146300 00006314 78040300 00000304 494d4300 00006159 41414100 0000007f
08102000 00000204 41417f00 00000041 01020400 00000402 40404000 00004040
07080000 00000003 54784000 00002054 44443800 00007f28 44442800 00003844
44287f00 00003844 54541800 00003854 7e090200 00000008 a49c7800 000018a4
04047800 00007f08 7d400000 00000044 403d0000 00002040 28440000 00007f10
7f400000 00000041 78047800 00007c04 04047800 00007c08 44443800 00003844
24241800 0000fc18 2418fc00 00001824 04040800 00007c08 54542400 00004854
3f442400 00000404 40207c00 00003c40 40201c00 00001c20 30403c00 00003c40
10284400 00004428 90907c00 00004c90 544c4400 00004464 36410000 00000008
77000000 00000000 36080000 00000041 02040200 00000201 23263c00 00003c26
a1611200 00001ea1 40207a00 00003a40 54555900 00003854 55794100 00002155
54784200 00002254 54784000 00002155 55794000 00002054 52721200 00000c1e
55555900 00003955 54545900 00003954 54545800 00003955 457c4100 00000000
457d4200 00000002 457c4000 00000001 11127d00 00007d12 2528f000 0000f028
55450000 00007c54 547c5400 00002054 097f4900 00007c0a 49493200 00003249
44443a00 00003a44 48483000 0000324a 41217a00 00003a41 40207800 00003a42
a0a07d00 0000009d 42423d00 00003d42 40403d00 00003d40 ff242400 00003c24
49436600 0000487e fc2f2b00 00002b2f 29f62000 0000ff09 7e090300 0000c088
54794100 00002054 447d4100 00000000 484a3200 00003048 40227a00 00003840
0a0a7200 0000007a 19317d00 00007d0d 292f2800 00002629 29292600 00002629
4d402000 00003048 08080800 00003808 08083800 00000808 c8acba00 00002f10
2834fa00 00002f10 7b000000 00000000 2a142200 00000814 2a140800 00002214
5500aa00 0000aa00 aa55aa00 0000aa55 00ff0000 00000000 10ff0000 00001010
14ff0000 00001414 ff00ff00 00001010 f010f000 00001010 14fc0000 00001414
f700ff00 00001414 ff00ff00 00000000 f404fc00 00001414 17101f00 00001414
1f101f00 00001010 141f0000 00001414 10f00000 00001010 001f1000 00000000
101f1000 00001010 10f01000 00001010 00ff1000 00000000 10101000 00001010
10ff1000 00001010 00ff1400 00000000 ff00ff00 00000000 1f101700 00000000
fc04f400 00000000 17101700 00001414 f404f400 00001414 ff00f700 00000000
14141400 00001414 f700f700 00001414 14171400 00001414 1f101f00 00001010
14f41400 00001414 f010f000 00001010 1f101f00 00000000 001f1400 00000000
00fc1400 00000000 f010f000 00000000 ff10ff00 00001010 14ff1400 00001414
101f0000 00001010 00f01000 00000000 ffffff00 0000ffff f0f0f000 0000f0f0
ff000000 0000ffff 00ffff00 00000000 0f0f0f00 00000f0f 44384400 00003844
4a4a3400 0000fc4a 02060600 00007e02 027e0200 0000027e 49416300 00006355
443c0400 00003844 201e2000 0000407e 7e020200 00000602 e7a59900 000099a5
492a1c00 00001c2a 01724c00 00004c72 4d4d3000 0000304a 78483000 00003048
5a463d00 0000bc62 49490000 00003e49 01017e00 00007e01 2a2a2a00 00002a2a
5f444400 00004444 4a444000 00004051 4a514000 00004044 ff010300 00000000
ff000000 0000e080 6b6b0800 00000808 36243600 00003612 090f0600 0000060f
18180000 00000000 10100000 00000000 ff010100 00003040 01011e00 0000001f
1d171200 00000019 3c3c3c00 0000003c 00000000 00000000
END CFUNCTION

You should see
RUN
00001C577D571C00
>


Do you ?

Peter
The only Konstant is Change
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 03:26pm 25 Nov 2014
Copy link to clipboard 
Print this post


Peter,
When I run your above code (on B23) I get:

>RUN
0000000000000000
>

that is, 16 zero's.

Greg
 
G8JCF

Guru

Joined: 15/05/2014
Location: United Kingdom
Posts: 676
Posted: 03:39pm 25 Nov 2014
Copy link to clipboard 
Print this post

What !!!!!!!!

That can't be !!!

What is going on ??????

Thanks Greg, I think you may have cleared up as to what is going on.

Micromite MkII MMBasic Ver 4.6 Beta 20
Copyright 2011-2014 Geoff Graham

>
> RUN
00001C577D571C00
>


Ah, On B20 it works fine, on B24 it works fine, but I haven't tried it on B23 !!!

Micromite MkII MMBasic Ver 4.6 Beta 24
Copyright 2011-2014 Geoff Graham

> RUN
00001C577D571C00
>


So @WW, downgrade to Beta20 and try again, or upgrade to Beta 25

PeterEdited by G8JCF 2014-11-27
The only Konstant is Change
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 05:24pm 25 Nov 2014
Copy link to clipboard 
Print this post

Just re-flashed to B25 Peter and I now do get:
>RUN
00001C577D571C00
>

Greg
 
boss

Senior Member

Joined: 19/08/2011
Location: Canada
Posts: 268
Posted: 07:22pm 25 Nov 2014
Copy link to clipboard 
Print this post

B25: Yes

> run
00001C577D571C00
>

Bo
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8584
Posted: 10:51pm 25 Nov 2014
Copy link to clipboard 
Print this post

The new b25 release with OPTION DEFAULT NONE has revealed one routine where I haven't typed the LOCAL variables

Please substitute the attached Fill Trangle (ftri) routine to correct this.

With this change the code will now work properly with all variables fully declared and typed irrespective of the OPTION DEFAULT.


sub ftri (x0 as integer,y0 as integer,x1 as integer,y1 as integer, x2 as integer,y2 as integer) 'three coordinate pairs
local as integer a,b,y,dp,last
if (y0>y1) then
swap(y0,y1)
swap(x0,x1)
endif
if (y1>y2) then
swap(y2,y1)
swap(x2,x1)
endif
if (y0>y1) then
swap(y0,y1)
swap(x0,x1)
endif
if(y0=y2) then ' Handle awkward all-on-same-line case as its own thing
a=x0
b=x0
if(x1<a) then
a=x1
else
if(x1>b) then b=x1
endif
if(x2<a) then
a=x2
else
if(x2>b) then b=x2
endif
dFastHLine(a,y0,b-a+1)
exit sub
endif
local as integer dx01=x1-x0, dy01=y1-y0, dx02=x2-x0, dy02=y2-y0,dx12=x2-x1, dy12=y2-y1, sa=0,sb=0
if(y1=y2) then
last=y1 'Include y1 scanline
else
last=y1-1 ' Skip it
endif
for y=y0 to last
a=x0+sa \ dy01
b=x0+sb \ dy02
sa=sa+dx01
sb=sb+dx02
a=x0+(x1-x0) * (y-y0) \ (y1-y0)
b=x0+(x2-x0) * (y-y0) \ (y2-y0)
if(a>b) then swap(a,b)
dp=ffr(ON,a,y,b-a+1,1,rot,wi,ht,sc())
next y
sa=dx12 * (y-y1)
sb=dx02 * (y-y0)
do while y<=y2
a=x1+sa \ dy12
b=x0+sb \ dy02
sa=sa+dx12
sb=sb+dx02
a=x1+(x2-x1) * (y-y1) \ (y2-y1)
b=x0+(x2-x0) * (y-y0) \ (y2-y0)
if(a>b) then swap(a,b)
dp=ffr(ON,a,y,b-a+1,1,rot,wi,ht,sc())
y=y+1
loop
end sub
'
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 11:42pm 25 Nov 2014
Copy link to clipboard 
Print this post

Hi Peter,

Sorry I didn't try until now - just woke up to your message (and Beta 25).

Confirming that B23 produced all zeros (as already stated by 'paceman').

Then upgraded to B25 (rather than down to B20 which you knew works ok). B25 returned correct value for me (also as confirmed by 'boss' and 'paceman' above).

Now the program/code works as expected without my workaround.

So do we know why B23 produced all zeros? was it a firmware issue?? Just curious if anyone knows . . . .

Thanks ALL for your assistance in solving this one

WWEdited by WhiteWizzard 2014-11-27
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 01:54pm 26 Nov 2014
Copy link to clipboard 
Print this post

@matherp,

Peter, I've got a couple of Nokia5110's here but it'll likely be weeks before the OLED displays arrive. Any chance of posting your latest updated graphics code with the Nokia5110 drivers?

Greg
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 04:34pm 26 Nov 2014
Copy link to clipboard 
Print this post

@matherp

I have a couple of questions regarding the S-Clearsc sub:

[code]Sub S_Clearsc
local as integer i,j
for i=0 to 7
S_cursor(0,i)
for j=0 to 127 step 16
I2C WRITE i2caddr,0,33,&H40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0
next j
next i
for i=0 to 127
sc(i)=0
dd(i)=0
next i
end sub [/code]

1> Why is the I2C writing 32 zero's for the 8 times that the j For-Next loop runs? This is hence sending 32x8=256 bytes but there is only 128 pixel across. Could this be changed to step 32 (in the For j . . . line) without causing issues elsewhere? (this would run quicker than the alternative change of looping 8 times but only writing 16 zeros each time).

2> Exactly what info/data do the sc and dd 128 element arrays hold?

3> If you call the S_Clearsc sub in code, does it clear the OLED by itself; or do you need to issue a S_Refresh too?
PLEASE NOTE: I am not in front of my OLED to try this out now otherwise I obviously would do!

Many thanks,

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8584
Posted: 03:07am 27 Nov 2014
Copy link to clipboard 
Print this post

WW

It should be step 32 - good catch

You do not need a refresh after a clear screen, the clear screen does the write itself.

The physical screens are organised as 8 rows of data each 128 columns long. Each column/row combination has 8 bits which represent 8 vertical pixels i.e. 8x8 =64 pixels high. The arrays are 128 elements long and each element is a 64 bit integer so each array has exactly the same number of bits as the screen has pixels. Pixel 0,0 on the screen is bit 0 of the 0th element of the arrays. The dd array contains what is actually on the screen. The sc array contains the local copy after changes made by the drawing primitives. Refresh brings these back into line.

If you look at the use of the ffr routine in the frect function you will notice that the first parameter is "ON". If you want to do a small scale clear then you could create a version of frect that blanks a small area of screen as below

sub clearrect(x as integer,y as integer,w as integer,h as integer) 'x,y coordinate of top left,width,height
local as integer dp
dp=ffr(OFF,x,y,w,h,rot,wi,ht,sc())
end sub

Then a refresh will only blank the relevant pixels and depending on size will be much quicker than clearscreen.

All of the drawing primitives use either "pix" or "ffr" to write to the "sc" array. Both have this capability to take ON or OFF as a parameter so you could create other "clear" versions if this helps

 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 02:31pm 27 Nov 2014
Copy link to clipboard 
Print this post

BIG help - THANK YOU
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8584
Posted: 05:41am 28 Nov 2014
Copy link to clipboard 
Print this post

New version with all text drawing in cFunctions and further optimised refresh routines.

Text routines now 20x faster. This version doesn't include the flashing cursor so screen refresh is left to the user. See the main program for examples of usage of all user functions

2014-11-28_154013_Graphics0.9.zip
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 07:39pm 28 Nov 2014
Copy link to clipboard 
Print this post

Good evening Gent's

I came across a Display ( www.sparkfun.com/products/13192) that is very low power and functions like "e-paper".. Was wondering what you thought of it... It already has a library for it and is SPI based so would be much faster update speed...
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8584
Posted: 10:36pm 28 Nov 2014
Copy link to clipboard 
Print this post

SPI probably works out slower on the micromite as each basic command can only output a maximum of 32 bits. Using i2c we can output up to 255 bytes in a single basic command so although the i2c bus speed is slower the overhead of the interpreted basic means i2c works out quicker for larger amounts of data.
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 04:40am 29 Nov 2014
Copy link to clipboard 
Print this post

Humm...

I2C at 400kc or SPI at 10meg... That sure must be some awesome "overhead"...

Anyway, I was looking at the unit because of the low power "average" consumption would be an advantage for the "works on battery" group...
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8584
Posted: 09:30am 29 Nov 2014
Copy link to clipboard 
Print this post

My guess calculation for something like the 128x64 monochrome graphics display using Geoff's estimate of 30000 basic instructions per second goes like this:
I2C: 4 basic instructions per 128bytes (32 total) @ 1/30000secs per basic instruction + 128*8*8bits @400000 bps +128*8*1 ack =0.024sec
SPI: 128*8*8bits @10000000bps (trivial amount of time) + 4 basic instructions per 32 bits (running the loop and getting the data for each SPI) = 128*8*8/32*4/30000 =0.035sec.

Both these are of course underestimates as there will be interrupts taking place internal to the firmware to load the data into the output registers in the PIC.

More importantly both of course will be completely overwhelmed by the time taken to prepare useful data to output in the first place!

For reference my clearscreen algorithm for the SSD1306 display uses 8 x 128byte i2c outputs as above and takes a total of 0.062 seconds to complete.

Of course these calculations change if you are managing the SPI output from within a cFunction or in another fully compiled environment but on the micromite, using basic, i2c is probably slightly faster but the difference is trivial certainly compared to the time taken to prepare something worth outputting!

Does look an interesting display though....Edited by matherp 2014-11-30
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024