LCD 128x64 with ST7920 - display buffer

Discussion in 'Embedded Systems and Microcontrollers' started by mojo_risin, Dec 11, 2013.

  1. mojo_risin

    Thread Starter Member

    Jul 3, 2013
    Hello everyone

    I got this LCD last week (datasheet) and I've been trying to get it working since. I hope there are people who got this thing to do what is expected. So far I can use it in character (basic) mode with its own giant characters, and in graphics (extended) mode. In graphics mode I can display an image on the screen - I am using a 1024-byte constant array and rendering it on the LCD. This part works. The thing that I want to do is to display a waveform from one of the ADCs on the LCD. I am using PIC24FJ128GC006 with 8 kb of RAM.

    So to get this thing done I need a 1024-byte singe dimensional array in RAM, which I can afford now. But I don't have any idea how to alter the contents of that array in real time and display it. I mean I know how to alter it in program, but I don't know how to get the data from the ADC into the array. I don't have a clue how to set the timing and everything. I was looking for similar projects, but most of them are in Arduino and using ready-made libraries, that I can't really understand fully (not very experienced).

    The wave that comes into the ADC has pretty low frequency - no more than 4 Hz, and is not a sine wave, but fairly complex. I need to be able to display about 5 seconds from the wave.

    I am generally looking for suggestions, not ready-made solutions... Any help would be welcome!

  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    An oscilloscope graph has time on the X axis, and amplitude on the Y. To get this digitally, you just draw a point to represent the amplitude at a time, then at the next time move over a pixel row and draw a new pixel point.

    You want to display 5 secs of data, and have 1024 storage places. That implies you need to make a measurenent every 5/1024 = .00488 seconds (about 5 mS). So you take the A2D reading, store it in your memory, then either in real time or at the end present the data to the display.

    With 256 A2D bits in and 64 display bits out, you need to compress the data. No problem, just shift over 2 bits.