Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC plus-5110 LCD-GPS-BMP280-HMC5983

Status
Not open for further replies.
hi Nigel,
Not using a screen image/buffer, it is a character by character write to the screen,
The write procedure gets each character in turn from a string message, writes that to the screen then gets the next character in the string message.
The procedure uses two leading parameters that prefix the string , Row and Column numbers.

It sounds slow but writing a full screen of the normal or big characters, appears almost instantaneous. PIC internal clock at 8MHz

Hi Eric,

It's not a matter of speed, it's a matter of been able to draw graphics - as you can't read from the screen you can't draw a line (or any other shape) on the screen without it wiping out an 8 bit high area across the display. By using aRAM buffer, you can write the line to the buffer, which as you can read it you can avoid over writing existing data, and then refresh the entire screen from the buffer.

I've been playing with the 16F1827 version more today, and I've got the hardware working again (at LAST!!) - I knew it'd be something stupid, and I had CKE set the wrong way :oops:

Here's a routine for drawing a horizontal line on the 5110, using a screen buffer, and the routine which copies it to the screen. You draw whatever you want to the buffer, then call Nokia_Update() to display it. If you're just displaying text, and you're not concerned with upsetting what's already on the screen, then there's no need to buffer.

Code:
void Nokia_ClrHLine(int x, int y, int l)
{
   int by, bi, cx;

   if ((x>=0) & (x<84) & (y>=0) & (y<48))
   {
       for (cx=0; cx<l; cx++)
       {
           by=((y/8)*84)+x;
           bi=y % 8;

           scrbuf[by+cx] &= ~(1<<bi);
       }
   }
}

void Nokia_Update()
{
   unsigned int b;
    if (_sleep==FALSE)
   {
       Nokia_WriteCmd(PCD8544_SETYADDR);
       Nokia_WriteCmd(PCD8544_SETXADDR);
       for (b=0; b<504; b++)
           Nokia_WriteData(scrbuf[b]);
   }
}
 
Is it slow?

Yes it is :D

Such LCD's don't update very fast, they are really only suitable for static images - so there's no need to write the data with any great speed, particularly as the maximum data is only 504 bytes. If you're using colour LCD's it's a different matter, they respond much faster, and the amount of data is MUCH greater (pixel based, rather than byte based + colour data).

I've just used 1MHz SPI (maximum for the hardware with a 4MHz clock) and software SPI (at about 15KHz - due to the free version of XC8), it makes no real difference.
 
hi Nigel,
When I get my colour LCD's I will start graphics, I have done it in the past with a monochrome LCD.
Camerart, I understand is only interested in alpha numeric data at this time, thats why I focussed on text.

E
 
Hi Eric,

It's not a matter of speed, it's a matter of been able to draw graphics - as you can't read from the screen you can't draw a line (or any other shape) on the screen without it wiping out an 8 bit high area across the display. By using aRAM buffer, you can write the line to the buffer, which as you can read it you can avoid over writing existing data, and then refresh the entire screen from the buffer.

I've been playing with the 16F1827 version more today, and I've got the hardware working again (at LAST!!) - I knew it'd be something stupid, and I had CKE set the wrong way :oops:

Here's a routine for drawing a horizontal line on the 5110, using a screen buffer, and the routine which copies it to the screen. You draw whatever you want to the buffer, then call Nokia_Update() to display it. If you're just displaying text, and you're not concerned with upsetting what's already on the screen, then there's no need to buffer.

Code:
void Nokia_ClrHLine(int x, int y, int l)
{
   int by, bi, cx;

   if ((x>=0) & (x<84) & (y>=0) & (y<48))
   {
       for (cx=0; cx<l; cx++)
       {
           by=((y/8)*84)+x;
           bi=y % 8;

           scrbuf[by+cx] &= ~(1<<bi);
       }
   }
}

void Nokia_Update()
{
   unsigned int b;
    if (_sleep==FALSE)
   {
       Nokia_WriteCmd(PCD8544_SETYADDR);
       Nokia_WriteCmd(PCD8544_SETXADDR);
       for (b=0; b<504; b++)
           Nokia_WriteData(scrbuf[b]);
   }
}
Hi N,
I'm afraid I can't read the above, because it's not BASIC. I've been going through Eric's BASIC program, and even though it's written exactly as I like it, it still takes me a long time to get it. Sorry for my limitations :(
C.
 
Hi,
Previously I showed a program for Graphics: https://www.ablab.in/image2glcd-software/
Members said it wasn't for this purpose! I was just checking it before deleting it, and it looked somehow interesting?
Here is a Square drawn in PAINT, which has been converted to HEX using this program, is it definitely not useful for graphics and these screens?
C.
 

Attachments

  • blob.png
    blob.png
    7.5 KB · Views: 207
  • blob.gif
    blob.gif
    63 KB · Views: 207
Here is a Square drawn in PAINT, which has been converted to HEX using this program, is it definitely not useful for graphics and these screens?

It's perfectly fine, you can just copy it to the 5110 display just as you would in the line drawing example above. Basically all you're doing is drawing the graphics on your computer and then loading them to the display, rather than drawing them in your PIC, and then loading them to the display. As long as you're very careful, you can load such a graphic to the 5110, and then write text over it - you just have to be sure to miss the graphics :D

If you look at this project:

https://electrosome.com/digital-thermometer-arduino-ds18b20/

It uses a similar technique, the thermometer symbol is a preloaded graphic, and the temperature value is written to avoid it, in a large font. I've got that exact project running in front of me, on an Arduino 3.3V Pro Mini, although it's only showing 18.3 degrees! :D
 
If you look at this project:

https://electrosome.com/digital-thermometer-arduino-ds18b20/

It uses a similar technique, the thermometer symbol is a preloaded graphic, and the temperature value is written to avoid it, in a large font. I've got that exact project running in front of me, on an Arduino 3.3V Pro Mini, although it's only showing 18.3 degrees! :D
Hi N,
Ok, regarding graphics.

I can't read your attached program, but thanks. This is why I'm on the Oshonsoft forum.
C.
 
Hi N,
Ok, regarding graphics.

I can't read your attached program, but thanks. This is why I'm on the Oshonsoft forum.

You don't need to read the program on the link, just look at the screen shots there (and the video if you want), which demonstrate the mix of downloaded graphics (the thermometer symbol) and internal text. The thermometer graphic was probably generated using the same program as you've already downloaded.
 
You don't need to read the program on the link, just look at the screen shots there (and the video if you want), which demonstrate the mix of downloaded graphics (the thermometer symbol) and internal text. The thermometer graphic was probably generated using the same program as you've already downloaded.
Hi N,
Ok, I see, thanks.
Actually, as Eric mentions, I am quite happy at the moment to be able to use the 5110 as a text readout as an alternative to the 4X20 type, it's much neater.
C.
 
hi C,
You may find this program of interest, give it a run.
E
 

Attachments

  • Cam5110_V5.bas
    7.9 KB · Views: 210
Hi E,
Bad news! 'Not enough ram' Don't panic, if you recall I had to change from 18LF2520 to 18F2420, because of the dodgy PCB I made. I am in progress of making a new 18LF2520 PCB, I'll be able to try it then.

Looks like you've got scrolling etc.

I've got to finish designing the SCH, then position the components on the PCB, then transfer it to the board, with an untried process, then etch it, then stick the bits on. It may be a while!
C
 
hi C,
Flash and RAM memory is limited in some of the smaller PIC's, Fonts and Strings are greedy little beggars.
That's why I test with the PIC 18F4520 and PICF4620.

That V5 program scrolls Left for normal and big fonts.

E
 
hi C,
Flash and RAM memory is limited in some of the smaller PIC's, Fonts and Strings are greedy little beggars.
That's why I test with the PIC 18F4520 and PICF4620.

That V5 program scrolls Left for normal and big fonts.

E
Hi E,
The 18LF2520 has the same RAM as the 4520 (I think).
I'll have a go at cleaning the 'dirty' PCB, to see if it works.
C.
 
If anyone is interested, here's a video of my 5110 running a C demo (converted from Arduino C++) on a PIC 24F - it's actually two demos, the end clock display is a different demo.

It's about 30meg, so here's a link:



Incidentally, I've been really struggling to take close-up images or videos, I used a Nikon compact camera for this, with macro-mode selected.
 
Looks OK.:)
The clock needs a little work, looking forward to seeing some of your colour LCD work.
My modules are due early Nov.
E
 
Hi N,
Are the examples actual readouts i,e, the sign wave or simply a loaded program?
C.

It's just a loaded program as a graphic demonstration of the 5110 library, the clock at the end is driven by a simple routine I wrote for the demo - it generates a random hour, minute, and second, then it's driven by timer interrupts at one second intervals. I have also had it running using the same hardware from a DS3231 I2C clock module - a similar one second interrupt, but generated by the DS3231, was used to update the clock display.

This is the sine wave part:

Code:
    Nokia_ClrScr();
    Nokia_DrawRect(0, 0, 83, 47);
    Nokia_DrawLine(0, 23, 84, 23);
    Nokia_DrawLine(41, 0, 41, 47);
    for (c = 0; c < 4; c++) {
        for (i = 0; i < 84; i++) {
            y = i * 0.017453292519943295769236907684886;
            Nokia_InvPixel(i, (sin(y * 6)*20) + 23);
            Nokia_Update();
            Delay_ms(20);
        }
    }

I know it's in C, but it's simple to understand - the first four lines clear the screen, and draw the background.

'for (c=' runs the routine four times, and 'for (i+' draws the 84 dots across the screen.

InvPixel inverts a pixel in the buffer (you can't do it on the screen, as it's read only), Update transfers the buffer to the screen.

I've no idea what the scaling value 0.017453292519943295769236907684886 is all about?, it was in the routine when I downloaded the Arduino version.
 
Hi N,
Are the examples actual readouts i,e, the sign wave or simply a loaded program?
C.
Do you mean are the displayed graphics in the demo calculated online or loaded from a precalculated data?
The pixels in lines, circles, rectangles are calculated in real time in a screen buffer in ram and then the lcd is updated from the buffer after one line, circle or rectangle is ready.
The same with the sine wave, but there is a 20ms delay between screen updates.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top