View previous topic :: View next topic |
Author |
Message |
olhexy
Joined: 03 Apr 2011 Posts: 192 Location: Tilburg, Netherlands
|
Posted: Tue Jun 19, 2012 10:14 am Post subject: KS0108 on XRAM |
|
|
I use an STK200 board and I am upgrading it with XRAM. My AVR is an Atmega162V. I use this display: http://www.voti.nl/docs/LCD-19-HG1286418C-VA.pdf
I "need" the XRAM because of several reasons:
-I need more buffer space for serial, etc.
-SDcard needs more RAM to to run AVR-DOS
-(As far as I understand) the KS0108 can accept 1MHz bytes read/write, without needing to read busyflags. Filling the full128x64 screen could be done in 128x64/8=1024 usec. So using bus mode is fastest (I think).
And when I have the XRAM it is a waist of pins if I run the LCD in port mode.
To make HD44780 char LCD running in busmode is no problem for me.
But it seems that Bascoms GLCD library is designed only for port mode.
What I want is this: use the same lines from STK200 LCD-connector for KS0108.
I have available adres lines:
$lcd = &HC000
$lcdrs = &H8000; I want to redefine this as &H8000=0 CS1 and &H8000=1 CS2. On the LCD this signal is connected to CS1 and (via an inverter with BS170) with CS2. The R/W at the LCD is connected to ground, so the LCD can only be written, not read.
So here is the question: how do I configure this in Bascom?
How to adapt it to the available librairies, or how to adapt the librairies. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Jun 19, 2012 8:40 pm Post subject: |
|
|
it is not so hard.
make a copy of the lib, and the locate this code :
_gwrite_data:
* Sbi _glcd_portm , _glcd_cd ; Data
_gwrite_datamisc:
@genus(5)
* Out _glcd_port , R24 ; Write
* Cbi _glcd_portm , _glcd_rd ; Write Low
* Sbi _glcd_portm , _glcd_enable ; Enable Chip
@genus(2)
* Cbi _glcd_portm , _glcd_enable ; Disable Chip
;rcall _gRead_Status
Ret
you need to replace the *out with a ST X,r24 command.
The rd and wr lines you do not need to alter, they can be remarked and are handled by the chip.
you do need an address like &H8000 that will activate writing to the display.
Instead of the out you can use :
ldi r26,$00
ldi r27,$80
st x,r24
of course this will mean that r26/r27 are destroyed so you need to save/restore them:
push r26
push r27
ldi r26,$00
ldi r27,$80
st x,r24
pop r27
pop r26
the rd/wr signals might require that you add wait states.
using bus mode is good when you have a display that has address lines.
for the read you must do similar. look at : In r1, _glcd_port_in ; get byte
and then use Ld r1,X _________________ Mark |
|
Back to top |
|
|
olhexy
Joined: 03 Apr 2011 Posts: 192 Location: Tilburg, Netherlands
|
Posted: Thu Jun 21, 2012 12:12 am Post subject: |
|
|
Thanks! I have an entry point now.
If there is a way for me to read somewhere the meaning (definitions) of:
_glcd_portm
_glcd_cd
_gwrite_datamisc
where can I find them?
[Edit_1:] I am studying now the glcdKS0108.lib; I can understand what is happening there.
[Edit_2:] 2074Beta. Options chip OK button gives
WARNING Application Error
Unable to write to C:\Program Files\MCS Electronics\BASCOM-AVR\NONAME6.CFG.
It seems that XRAM options settings are not processed. Tooltip says to use CONFIG XRAM instead.
It is not clear what to choose for a 90s8515. There is only 1 waitstate, I don't know if it is in the hs or ls (I think original 90s8515 cannot have waitstate difference between sectors). Am I supposed to set the waitstate in the MCUCR register? Doesn't the compiler need to know about that?
I will try "waitstate=1". Because "waitstate=0" also exists in some ks108.cfg. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|