t6963c screen updates

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm quite happy to have gotten my t6883c gLCD working with my mega32 this afternoon. It seems I need to clear the JTAGEN fuse and then things started working nicely.

I'm using the libraries from
http://en.radzio.dxp.pl/t6963/
and reading a value in from an ADC then drawing the result, however everything draws on top of the previous values. aside from clearing the screen before each draw how can i prevent this?

here's my code so far...

machs@electric-monk:~/avr_projects/code$ cat accelTest001.c
#include 
#include "T6963C.h"
#include "Graphic.h"
#include "adcSingle.h"

void updateDisplay(void);
void updateDisplayGraph(void);

const char accelXString[9];
const char accelYString[9];

#define axisXScaler        (GLCD_PIXELS_PER_LINE / 255)
#define axisYScaler        (GLCD_NUMBER_OF_LINES / 255)

int main(void)
{
   adcInit();
   sei();                               //enable global interupts
   adcSingleConversion();

   GLCD_Initalize(); // Initalize LCD
   GLCD_ClearText(); // Clear text area
   GLCD_ClearCG(); // Clear character generator area
   GLCD_ClearGraphic(); // Clear graphic area

   GLCD_TextGoTo(0,0);// set text coordinates
   GLCD_WriteString("http://en.radzio.dxp.pl/t6963/"); // write text

   while(1){

      updateDisplayGraph();
   };

   return 0;
}

void updateDisplayText(void){
   //GLCD_ClearText(); // Clear text area
   itoa(adcValue0, accelYString, 10);
   itoa(adcValue1, accelXString, 10);
   GLCD_TextGoTo(0,1);// set text coordinates
   GLCD_WriteString(accelXString); // write text
   GLCD_TextGoTo(0,2);// set text coordinates
   GLCD_WriteString(accelYString); // write text
}

void updateDisplayGraph(void){
   //char width = 8;
   //char startY = (GLCD_NUMBER_OF_LINES - width )/2;
   //char startX =0;

   char length = adcValue0;
   GLCD_Rectangle ( 0 , 28, length, 8);
}   machs@electric-monk:~/avr_projects/code$

I've read a bit about using the display's on board RAM and seem to remember something about double buffering from a CS course but am at a lost as where to begin.

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One solution is have the frame buffer in avr ram, (which can be accessed faster than the ram on the lcd as a good side effect), draw into the frame buffer, then copy byte at a time to the lcd, which is very fast.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hmmmm, alright so I'd have a frame buffer in the AVR's ram and write to the display using a function like

//Writes a Chunk from OnChip-RAM
void T6963cWriteChunk(uint8_t* pBuffer, uint16_t nBytes);

? ( this comers from Simon Kueppers t6963c code from the project library)

what is it i'd write into this frame buffer?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You pretend that's the lcd screen. Usually the setpixel and clearpixel are hw specific, then all the other line and fill routines call set and clr pixel. When you're done drawing, copy it all to the lcd in a loop.

Imagecraft compiler user