LCDInfo.com http://forum.lcdinfo.com/ |
|
Something better for the ks0108b http://forum.lcdinfo.com/viewtopic.php?f=6&t=145 |
Page 1 of 1 |
Author: | DarkElf [ Tue Feb 18, 2003 12:51 ] |
Post subject: | Something better for the ks0108b |
hy all, nobody know me but this don't make me a newbee... my little brain just got an fabulous ![]() actually the ks0108b capacities aren't fully used: the read/write pin isn't used, so the LCD is use in delay more instead of busy mode. With the actual wiring it is impossible to connect the rw pin to the lpt port. So we need a little tweak... Ok, lets play... CS1 & CS2 select the chip you want to talk to BUT you can talk only to one chip at a time (LCDInfo do this, I have read the source). So when CS1 is active, CS2 is inactive and CS2=ON => CS1=OFF => two states: CS1 CS2 state 1: 1 0 2: 0 1 we don't need of two LPT pin to control this: just one is enought ![]() this inverter could be anything, a transistor should work (2n2222 ?) LPT: LCD: 16-Init-------------------------------------CS1 | | 5V | | / / 1K \ \ 4.7K / / \ \ | |--------------CS2 | ___| c | b / | /\ |__|_|/ | 2N2222 \ |\_/ ``| e _|_ ///// 14 -------------------------------------------------------RW Ok this look like very bad... I have got a better draw on a my floppy but someone have put something in this ù*$^* floppy drive. I will put something better after. What do you think of this |
Author: | Henri [ Tue Feb 18, 2003 14:19 ] |
Post subject: | |
Driving CS1 and CS2 with only one input is something I've also thought. I just haven't had the need to try that yet. I think you can see this used in some schematic linked at the KS0108 page. What would be the benefits of using the busy mode instead of delay ? I'm asking this because I've no idea how it would behave with that. Any chance for a speed up ? I think reliability could be improved, but this could also slow things down. Something I've thought to try is that would it be possible to drive both controllers at the same time ? This could be used to speed up the display clear and in other situations where same data can be written to both controllers. Although driving 128x64 KS0108 displays is pretty fast even with the current code so I haven't had the need to try this. In any case driving CS1 and CS2 with only one output is a good idea - I'm just not aware of the pros and cons of it. And supporting this wiring in LCDInfo shouldn't be very hard. |
Author: | samtech [ Tue Feb 18, 2003 20:46 ] |
Post subject: | |
This kind of idea shuold be great !! , one other tha would be interesting would be the implemen of some kind of GPO's like the matrix Orbital displays , one idea was to use a demultiplexer , and spilt one entrance to 8 or something , but with that we nedded 4 pins , one for the 4 entrances in alternating and 3 for the 3 select entrance gates , not the on foo circuitry woul allow if it was possilbe to route all this entrances to have 4 or 5 gpo's , tha coul be activated by a very simple on / off logic switch , tell me if i'm dreaming too much ![]() SAmtech |
Author: | Henri [ Tue Feb 18, 2003 21:03 ] |
Post subject: | |
First I'll have to admit that I didn't understand everything in the previous post. One GPO would be easy if the CS pins were controller using 1 line. But increasing them after that isn't so easy anymore and would need more work on the software. But I think everything could be done. |
Author: | DarkElf [ Wed Feb 19, 2003 14:28 ] |
Post subject: | |
utility of this? one of them: well in the last available source code you directly send datas to lcd, there is no virtual screen between the data & the lcd. Using the read function could permit to read datas of the lcd and to do an OR function between the data & what the lcd already have. (Ok this will slow up the write process: setcolomn;setpage;read;setpage;or_calc;writedata; instead of setcolomn;setpage;writedata;) I am looking at what you said: use of both chips... The diagram of my doc isn't very explicit, I think this should be tried, but who will try it? And is there is a risk? |
Author: | Henri [ Wed Feb 19, 2003 15:51 ] |
Post subject: | |
You are right, a buffer in software would be much faster. Something that can be found in the next LCDInfo ![]() I'm not sure if there's any risk in settings both controllers on at the same time. I have a feeling that I've already done this by mistake earlier while coding the KS0108 driver. |
Author: | DarkElf [ Thu Feb 20, 2003 15:18 ] |
Post subject: | |
I tried to make my own program, but stopped on the buffer to lcd algorithm (still searching): take a lcd like mine: ks0108b, 128x64 the easier way of stocking data into the buffer is one byte for 8 pixels (a char) so 128x64 / 8 => 1024 bytes so we make a Code: char buffer[1024]; each byte is 8 horizontal pixel: 1st byte: 8 first pixel 1st line 2nd byte: 8 next 1st line ... 17 byte: 8 first pixel 2nd line .... until end easy easy... now the transmission to the lcd: data are sent to the lcd by group of 8 pixel, but these pixel are vertical The only algorythm I found is something like this: Code: // pLCD = pointer to LCD buffer, char LCDBuffer[1024]
char tmp_data; for (int x=0;x<128;x++) { setcolomn(x); for (int y=0;y<8;y++) { setpage(y); data= (*(pLCD+y*16) & (1<<(8-(x%8))) | (*(pLCD+(y+1)*16) & (1<<(8-(x%8))); (*(pLCD+(y+2)*16) & (1<<(8-(x%8))); (*(pLCD+(y+3)*16) & (1<<(8-(x%8))); (*(pLCD+(y+4)*16) & (1<<(8-(x%8))); (*(pLCD+(y+5)*16) & (1<<(8-(x%8))); (*(pLCD+(y+6)*16) & (1<<(8-(x%8))); (*(pLCD+(y+7)*16) & (1<<(8-(x%8))); sendlcddata(data); } pLCD++; } This THING (is there is any other appelation?) is horrible. but i didn't tried it it may work or not, In fact I just wrote here what I have in my brain for 1 week, it is less horrible that I tought. |
Author: | Henri [ Thu Feb 20, 2003 17:11 ] |
Post subject: | |
This is how I've done it: It reads 8 bytes and then swaps the bits in this 8x8 bit block to the lcd format and writes them and then reads the next 8 bytes and so on... I'm sure it can be done better. Code: void CKS0108::WriteBuffer(unsigned char LcdData[])
{ unsigned char i, col, page, bitpos, lcdbyte, byteblock[8]; for(page=0;page<8;page++) { SetPage(page); SetColumn(0); for(col=0;col<16;col++) { for(i=0;i<8;i++) byteblock[i] = LcdData[page*128 + col + i*16]; for(bitpos=0;bitpos<8;bitpos++) { lcdbyte = 0; for(i=7;i>0;i--) { lcdbyte |= byteblock[i] >> 7 - bitpos & 1; lcdbyte <<= 1; } lcdbyte |= byteblock[i] >> 7 - bitpos & 1; WriteData(&lcdbyte,1); } } } } |
Author: | DarkElf [ Fri Feb 21, 2003 11:45 ] |
Post subject: | |
here is my code corrected... I made a mistake ![]() ![]() Code: void Graphic_LCD::CopyScr()
{ unsigned char *p_scr; unsigned char data; int x,y; p_scr = EcranVirtuel; // Met la page Y // Met la colonne X for (y=0;y<8;y++) { // change colonne; SendCmd(DISPLAY_PAGE_SET| (y & 7), LCD_CS1); SendCmd(DISPLAY_COLUMN_SET, LCD_CS1); for (x=0;x<64;x++) { data = ( *(p_scr + x%8 ) >> (x%8) & 1 )<<7 | // The function of the die ( *(p_scr + x%8 + 16 ) >> (x%8) & 1 )<<6 | ( *(p_scr + x%8 + 16*2) >> (x%8) & 1)<<5 | ( *(p_scr + x%8 + 16*3) >> (x%8) & 1)<<4 | ( *(p_scr + x%8 + 16*4) >> (x%8) & 1)<<3 | ( *(p_scr + x%8 + 16*5) >> (x%8) & 1)<<2 | ( *(p_scr + x%8 + 16*6) >> (x%8) & 1)<<1 | ( *(p_scr + x%8 + 16*7) >> (x%8) & 1 ); SendData(data, LCD_CS1); if (x>0 && x%8==0) p_scr ++; } SendCmd(DISPLAY_PAGE_SET| (y & 7), LCD_CS2); SendCmd(DISPLAY_COLUMN_SET, LCD_CS2); for (x=64;x<128;x++) { data = ( *(p_scr + x%8 ) >> (x%8) & 1 )<<7 | // The function of the die ( *(p_scr + x%8 + 16 ) >> (x%8) & 1 )<<6 | ( *(p_scr + x%8 + 16*2) >> (x%8) & 1)<<5 | ( *(p_scr + x%8 + 16*3) >> (x%8) & 1)<<4 | ( *(p_scr + x%8 + 16*4) >> (x%8) & 1)<<3 | ( *(p_scr + x%8 + 16*5) >> (x%8) & 1)<<2 | ( *(p_scr + x%8 + 16*6) >> (x%8) & 1)<<1 | ( *(p_scr + x%8 + 16*7) >> (x%8) & 1 ); SendData(data, LCD_CS2); if (x>64 && x%8==0) p_scr ++; } } } ![]() ![]() ![]() |
Author: | DarkElf [ Sat Feb 22, 2003 21:37 ] |
Post subject: | |
again wrong... this one the fully working code with full test (it work fine becaus i use it for my wmp plugin with a beautifull spectrum analyser) ![]() Code: void Graphic_LCD::CopyScr()
{ unsigned char *p_scr; unsigned char data; int x,y; p_scr = EcranVirtuel; // Met la page Y // Met la colonne X for (y=0;y<8;y++) { // change colonne; SendCmd(DISPLAY_PAGE_SET| (y & 7), LCD_CS1); SendCmd(DISPLAY_COLUMN_SET, LCD_CS1); for (x=0;x<64;x++) { if (x>0 && x%8==0) p_scr ++; data = ( (*(p_scr ) >> (7-(x%8))) & 1 ) | // The function of the die ( (*(p_scr + 16 ) >> (7-(x%8))) & 1 )<<1 | ( (*(p_scr + 16*2) >> (7-(x%8))) & 1)<<2 | ( (*(p_scr + 16*3) >> (7-(x%8))) & 1)<<3 | ( (*(p_scr + 16*4) >> (7-(x%8))) & 1)<<4 | ( (*(p_scr + 16*5) >> (7-(x%8))) & 1)<<5 | ( (*(p_scr + 16*6) >> (7-(x%8))) & 1)<<6 | ( (*(p_scr + 16*7) >> (7-(x%8))) & 1 )<<7; SendData(data, LCD_CS1); } SendCmd(DISPLAY_PAGE_SET| (y & 7), LCD_CS2); SendCmd(DISPLAY_COLUMN_SET, LCD_CS2); for (x=64;x<128;x++) { if (x%8==0) p_scr ++; data = ( (*(p_scr ) >> (7-(x%8))) & 1 ) | // The function of the die ( (*(p_scr + 16 ) >> (7-(x%8))) & 1 )<<1 | ( (*(p_scr + 16*2) >> (7-(x%8))) & 1)<<2 | ( (*(p_scr + 16*3) >> (7-(x%8))) & 1)<<3 | ( (*(p_scr + 16*4) >> (7-(x%8))) & 1)<<4 | ( (*(p_scr + 16*5) >> (7-(x%8))) & 1)<<5 | ( (*(p_scr + 16*6) >> (7-(x%8))) & 1)<<6 | ( (*(p_scr + 16*7) >> (7-(x%8))) & 1 )<<7; SendData(data, LCD_CS2); } p_scr += (16*7)+1; } } yeppe |
Author: | Henri [ Sun Feb 23, 2003 15:31 ] |
Post subject: | |
Good to see you getting it right ![]() |
Page 1 of 1 | All times are UTC + 2 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |