CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

LCD RAM clearing in extended GLCD Driver T6963C

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
aa7dj



Joined: 27 Apr 2007
Posts: 7
Location: St. George, UT

View user's profile Send private message

LCD RAM clearing in extended GLCD Driver T6963C
PostPosted: Tue Jul 24, 2018 10:08 am     Reply with quote

I'm working with 240x128 GLCD. Driver is like this: http://www.ccsinfo.com/forum/viewtopic.php?t=31255&highlight=t6963c
My question is about usage of function glcd_clr(location, size).
Code:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
// Purpose:       Clears LCD RAM
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
void glcd_clr(int16 location,int16 size)
{
  ////fprintf(DEBUG,"loc=%lu  size=%lu\n\r",location,size);
  // look very simular to the init,... doesn't it. : )
  glcd_WriteCmd2(location,LCDSetPtr);
  glcd_WriteCmd1(1,AutoModeWrite);
  for (;size;size--)
  {
    glcd_WriteByteAuto(0x00);//clear ram
  }
  glcd_WriteCmd1(1,AutoModeReset);
}

What are arguments "location" and "size"?

I found some info from "treitmey":
Quote:
and get the location using a define
#define LCDTxtAdr(s,x,y) 0x780+(240*s)+(AreaSet_T*y)+x
//that is the screen,x position , y position

so the call looks like

glcd_clr(LCDTxtAdr(SCRN0,0,0),CharPerScn);

But here I faced with new questions. What means "screen", "s", "AreaSet_T", "SCRN0", "CharPerScn"?
How can I determine these values?

Please help me understand how to use clearing for text and graphics.
Thank you.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Jul 24, 2018 12:18 pm     Reply with quote

CharPerScn = characters per screen. How many bytes does the screen use?.

Some displays have multiple virtual screens supported in their memory space. If you have such an ability, then an index to these is the 'screen' value.

Location is just the address in the display memory where you want to start 'from'. For most displays where the memory starts at 0, you would just use o for this.

The Treitmey define is for a display that has RAM starting at address 0x780, using AreaSet_T bytes per line.

All the figures for this depend on how the display RAM for your display is physically connected to the chip's address bus, and what part of this is used for the screen.

The data sheet for your display is where you need to start.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jul 24, 2018 4:42 pm     Reply with quote

With several 'virtual' screens available ,you can actually implement some very nice graphics. These 'onboard' screens should be a lot faster to display than sending data from PIC to LCD. A good read of the LCD manual would have this information.
Jay
aa7dj



Joined: 27 Apr 2007
Posts: 7
Location: St. George, UT

View user's profile Send private message

PostPosted: Tue Jul 24, 2018 8:33 pm     Reply with quote

Thanks for your replies.
CharPerScn: If about text characters it should be qty of 480 (30 ch x 16 ln). If speak about bytes it must be 3840.
I didn't see that HDM128GS24 has more than 1 screen.
I put a box filled with "1" over whole screen. And after that trying to run function glcd_clr() with many values of location and size. I found that size '
"1" clears few bits in first position in left upper corner. If change to "30" it do the same, but in 30th position on first line. Looks like size acts as location. But various numbers in expected "location" argument do nothing on the screen.
Here I want to mention that glcd_pixel, glcd_line, glcd_square, glcd_box, text position - all working okay and in correct places on the screen.
My problem is how to clear text and graphics and start new again.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Jul 24, 2018 11:35 pm     Reply with quote

The 'screen' ability, is changed by whether the display uses single scan or dual scan.
In single scan mode you can map screens however you want through the display space/
In dual scan mode far as I can see it has two memory areas. One for text starting at address 0, and one for graphics at address 0x7FFF.
If the display is simply connected, in single scan you can program it's start address offset. Look at page 15 of the data sheet section 2. This gives the relationship between the graphic RAM address and the display. Inside the RAM area, you can move the start, so can have as many screens as you can fit in the memory space.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Jul 25, 2018 3:03 am     Reply with quote

Pull this sheet:
<https://www.mpja.com/download/hdm128gs24l.pdf>
This contains an application note with descriptions of how to setup the T6963C controller for example display sizes.
You then need to look at your display, and check the part number of the RAM fitted. This will tell you how much space you actually have. The controller can operate up to 64KB of RAM, but typically displays will have much less fitted. This restricts the range of starting positions you can specify.
This display can be setup to be a dual scan or single scan unit. Your supplier should be able to tell you how yours is wired. Single scan is the more common.
There is a good description in this of how to set the row lengths.
aa7dj



Joined: 27 Apr 2007
Posts: 7
Location: St. George, UT

View user's profile Send private message

PostPosted: Wed Jul 25, 2018 7:47 am     Reply with quote

I have both GLCD and Data Sheet from MPJA. On the back of board I see 3 IC for 80 column each module. And 2 for rows. It is normal for this display. Only way to see single scan or dual is to check a level on pin 54. And how can I use this to change a code? Section 2 tells me nothing.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Jul 25, 2018 7:52 am     Reply with quote

You don't "use it to change code". You have to change your code to match how the display is set. Look at the memory diagrams in this sheet and the chip data sheet. These show how the RAM is mapped in the different modes. How much RAM is attached to the controller?. Don't you have a board manufacturer you can talk to?. They will be able to tell you whether it is set to single scan or dual scan, and how much memory is implemented. You also need to know how the MD2 to MD3 pin settings.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jul 25, 2018 8:22 am     Reply with quote

comment:
You need to post exactly which GLCD 'module' you are using. Manufacturer,model, spec sheet. Both PDFs posted, refer to a 'raw' or 'discrete' device that needs a lot of peripheral parts however usually you're buying a 'premade module'. It would include backlit control parts, possibly 3v interface devices, and usually an onboard MCU/SRAM as the 'controller' which does all the 'grunt work' of getting the right pixels lit up at the right time.
As well, be sure to post what size SRAM you're using .

Jay
aa7dj



Joined: 27 Apr 2007
Posts: 7
Location: St. George, UT

View user's profile Send private message

PostPosted: Wed Jul 25, 2018 7:38 pm     Reply with quote

Thank you very much. But it looks like you thinking my display is not working. No, it is working, I can put text in right place and draw line, rectangle, box etc.

What does not working I show in the code above, at the beginning. To use "glcd_clr" I need to know what is "location" and what is "size".
How to determine these two arguments?

Of course I can redraw all my graphics with "0" color and reprint text with "space" instead of characters. But there is special function dedicated for clearing and it should be used.
Simple question:"How?".
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 1:43 am     Reply with quote

We can't tell you.

You've been told multiple times now, this depends on how your display's hardware is configured. It's not a simple 'generic' answer for the chip.
Data is needed.
How many characters are actually fitted on a line is dependant on the MD2 & MD3 pins.
Though the chip supports 64K of RAM, it is probable that yours only has part fitted.
Then the actual 'map' layout is dependant on whether the chip is in single scan or dual scan mode.
Then where the graphics area actually 'is' depends on the offset values being configured into the controller.

The clear function, is a simple 'clear memory' operation. All you do is feed it the address location you want to start at, and how many bytes to clear. If (for instance) your graphic area was starting at 0x9FFF, with no offsets being used, then this would be the first address required, and if the lines are configured to be contiguous in the display, 3840 as the size. However it is possible to set the display up with gaps between lines, in which case more area would be needed, and also possible to configure the display to be offset in the area (giving virtual 'screens'), and in this case a higher starting address would be needed if an offset was being applied.
It is all down to understanding your display's memory map. We cannot tell you this. Only the people who wired the display and generated the initialisation code you are using, can tell you this.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 5:00 am     Reply with quote

As MR. T. points out, we can't UNTIL you provide us with more information. We NEED to know the manufacturer/model of GLCD and a link to the datasheet.
As pointed out , that display device can access 64K of SRAM, but the manufacturer of the module may have put 4K, 8K, 32K, 48K, 64K on board. Since the starting address of this 'virtual SRAM' can be any location AND the max size is 64KB, you know 2 pieces of the puzzle. The GLCD manual will tell you what they really are. Now I just thought of another possibility. There may be no SRAM, just the actual RAM that IS the LCD pixel data, so NO virtual memory. Again the GLCD datasheet will have that information.
It is possible to cut code to put 'Hello World' on to the screen at 0,0 (top left) and 'location address' in lower right (this you say you can do). Then, add code to call the erase function using a counter to increment the 'location' by 5 with 'size' set to 10, updating say every 500ms. Sooner or later 'Hello World' will be erased. 'location address' in the lower right will be the start of the virtual screen SRAM. When this happens be sure the program stops itself though ! This should work, though it'll take some time to execute.
This is why the GLCD datasheet is important. The information you want is there and only takes a minute to find, cutting test code could take you a week to find the same information.

I had a quick read of the datasheet and it appears the GLCD has an onboard 8K RAM. This is NOT the 'virtual RAM' that they talk about though, it's really the 'buffer' RAM between VRAM and the actual pixel drivers. The 'magic' number of 3840 is the number of bytes needed to represent all 240*128 pixels. It is unclear as to whether you can use the 'buffer RAM' as the VRAM. Since I don't have your GLCD I can't make a few simple tests to see what is really happening. However you must 'setup' or 'initialize' the GLCD.


Jay
aa7dj



Joined: 27 Apr 2007
Posts: 7
Location: St. George, UT

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 3:03 pm     Reply with quote

I already mentioned that display is HDM128SG24L made by Hartronix.
It has 8k RAM.
As I couldn't use "glcd_clr" function because of those unknown arguments I just wrote my own function to clear RAM. I merely write "0" over all 8k.
My problem is solved.
Thank you very much for willing to help and your time spent on my problem.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jul 26, 2018 4:41 pm     Reply with quote

Ok, so you have just the basic GLCD with NO 'external' RAM. The 8K RAM is actually inside the LCD module.
It may be that the glcd_clr(..) function you mention in your original post is to be used with the externam RAM or 'virtual' RAM that the datasheet takes about. Since I don't use that GLCD I can't test the driver.
At least you've got a solution that works !
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group