|
|
View previous topic :: View next topic |
Author |
Message |
donmezbilek
Joined: 06 Jan 2024 Posts: 4
|
Writing Text on LCD |
Posted: Sat Jan 06, 2024 9:16 am |
|
|
Hello,
I'm using the CCS compiler. I want to print text on an LCD screen. Normally, I use the glcd_text57(); function, which writes text horizontally. However, I'd like to write text as shown in the image, vertically. Could you please help me achieve this or suggest an alternative method?
Thank you in advance for your assistance.
İmage: https://hizliresim.com/f1hcvro
[img]https://hizliresim.com/f1hcvro[/img] |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sat Jan 06, 2024 10:33 am |
|
|
1st I'd ask google to search , see if someone has already done this !
if not you'll need to
1) create a font table for the 'sideways' characters
2) create a 'map' of 'rows and columns' for the 'sideways' locations
3) create functions to display the data( SWprint(........)
Both involve reading the GLCD datasheet and 'mapping out' the pixels. You should be able to use the GLCD driver as a reference.
I'd start with 'A' and upper left of the display.
These days there's probably some fancy internet help to create the characters, bit by bit..old dinosaurs like me used graph paper and pencils.
Get 'A' to display in upper left corner('home'), then create 'B',test,continue with the alphabet. THEN work out the row and columns 'math'.
I'd also name variables as SW...... short for SideWays so you don't get confused with your version of the GLCD driver !!!
Yes, it'll be slow going at first, but once you get ABC, the rest should go a lot faster ! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19495
|
|
Posted: Sat Jan 06, 2024 12:36 pm |
|
|
The answer depends massively on the LCD involved?. As Jay has said a
search may well find answers. Some displays do allow you to rotate the
whole screen. On others you have to code a custom font. A lot more work. |
|
|
donmezbilek
Joined: 06 Jan 2024 Posts: 4
|
|
Posted: Sat Jan 06, 2024 2:17 pm |
|
|
Ttelmah wrote: | The answer depends massively on the LCD involved?. As Jay has said a
search may well find answers. Some displays do allow you to rotate the
whole screen. On others you have to code a custom font. A lot more work. |
For example, I wrote a short text. The code is as follows;
#include <18f452.h>
#use delay(clock = 4000000)
#fuses HS,NOWDT,NOPUT,NOLVP,NOCPD,NOPROTECT,NODEBUG,NOBROWNOUT,NOWRT
#include <HDM64GS12.c>
#include <graphics.c>
char text1[] = "Text1";
char text2[] = "Text2";
void main()
{
setup_psp(PSP_DISABLED);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED, 0, 1);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_CCP1(CCP_OFF);
setup_CCP2(CCP_OFF);
glcd_init(on);
glcd_text57(1,1,text1,2,ON);
delay_ms(200);
glcd_text57(1,30,text2,2,ON);
delay_ms(200);
} // end of loop
Proteus Circuit: https://hizliresim.com/u7pec00
The image I want to be: https://hizliresim.com/pxgiapi |
|
|
donmezbilek
Joined: 06 Jan 2024 Posts: 4
|
|
Posted: Sat Jan 06, 2024 2:23 pm |
|
|
temtronic wrote: | 1st I'd ask google to search , see if someone has already done this !
if not you'll need to
1) create a font table for the 'sideways' characters
2) create a 'map' of 'rows and columns' for the 'sideways' locations
3) create functions to display the data( SWprint(........)
Both involve reading the GLCD datasheet and 'mapping out' the pixels. You should be able to use the GLCD driver as a reference.
I'd start with 'A' and upper left of the display.
These days there's probably some fancy internet help to create the characters, bit by bit..old dinosaurs like me used graph paper and pencils.
Get 'A' to display in upper left corner('home'), then create 'B',test,continue with the alphabet. THEN work out the row and columns 'math'.
I'd also name variables as SW...... short for SideWays so you don't get confused with your version of the GLCD driver !!!
Yes, it'll be slow going at first, but once you get ABC, the rest should go a lot faster ! |
I did some research, but I haven't found anyone who uses it this way. I wonder if there is a ready-made function for it. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sat Jan 06, 2024 3:34 pm |
|
|
you need to do some more research. I quickly found some Ardunio code, seems 'vertical' is a keyword to add while googling....
honestly, to make the 'sidewriting driver' should only take 1-2 days. You've got a working 'normal' driver and the GLCD datasheet.
one possible source would be the manufacturer of the GLCD. They may have 'application notes' about doing what you want.
I don't have your GLCD ,so I can't cut test code. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
|
|
|
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
|