How to print Extended ASCII codes and Greek Characters i.e: OMEGA, DELTA,etc using I2C and HCMODU0163

Forum for posting topics and questions about anything.
Post Reply
RetroBoy
Posts: 73
Joined: Sat Feb 26, 2022 11:29 am
Location: U.K.

How to print Extended ASCII codes and Greek Characters i.e: OMEGA, DELTA,etc using I2C and HCMODU0163

Post by RetroBoy » Tue Mar 15, 2022 4:39 pm

Is there any way of being able to print these characters using the I2C Interface ?
From looking at the specs for the HCMODU0163 module, it can be done using UART Interface. That means, I would assume, that the ASCII/EXTENDED codes are stored somewhere. If so how do I access them with the I2C Interface ?

andrew
Site Admin
Posts: 1376
Joined: Sun Aug 05, 2012 4:15 pm

Re: How to print Extended ASCII codes and Greek Characters i.e: OMEGA, DELTA,etc using I2C and HCMODU0163

Post by andrew » Wed Mar 16, 2022 9:17 am

If you want to print custom characters via I2C interface, there is actually a couple of example sketchs in the SmartLCDI2C library that show you how to do it. See the following sketches in the libraries example folder:

SmartLCD_Custom_Character_Example.ino
SmartLCD_Custom_Character_Example2.ino

In particular the second example sketch has examples for Omega, degree, plus/minus, & mu.

The library can be found here:

viewtopic.php?f=58&t=2206
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

RetroBoy
Posts: 73
Joined: Sat Feb 26, 2022 11:29 am
Location: U.K.

Re: How to print Extended ASCII codes and Greek Characters i.e: OMEGA, DELTA,etc using I2C and HCMODU0163

Post by RetroBoy » Wed Mar 16, 2022 7:32 pm

Hi Andrew,
Thanks for that, I have already been doing that ... works well.
What I actualy mean is that by looking at the UART 'AT' commands they are able to print Extended Character codes. So my quest should be ... Can that also be done using I2C.
If the 'AT' command can get the ASCII Character ( albeit Extended ) then the ASCII must be stored already on the CHIP. So again ... where is it and how to access it using I2C.
Sorry to be such a pain.

RetroBoy
Posts: 73
Joined: Sat Feb 26, 2022 11:29 am
Location: U.K.

Re: How to print Extended ASCII codes and Greek Characters i.e: OMEGA, DELTA,etc using I2C and HCMODU0163

Post by RetroBoy » Wed Mar 16, 2022 10:30 pm

Hi again.
If I want to print the Ohm/Omega symbol ' Ω ' ( ASCII 234 ) why would I need to define it in the custom character database.
As a further example, I very often need to use Danish and Polish characters. So classic Danish would be \ae\ ' æ ' ( ASCII 145 or 91h ) or \AE\ 'Æ' ( ASCII 146 or 92h). With Polish I would also use the 'Slashed L' \/L\, this involves changing my code page but works. My normal code page also has ' µ ' , ' ß ', ' Φ ', ' ± ' ,' δ ', ' ¥ ', to give a few. These must be within the HD44780 ROM Code. A00 seems standard with A02 being A00PLUS. All I really want to know is are they accessible Yes/No and if Yes 'How' ?

andrew
Site Admin
Posts: 1376
Joined: Sun Aug 05, 2012 4:15 pm

Re: How to print Extended ASCII codes and Greek Characters i.e: OMEGA, DELTA,etc using I2C and HCMODU0163

Post by andrew » Thu Mar 17, 2022 3:01 pm

What I actualy mean is that by looking at the UART 'AT' commands they are able to print Extended Character codes. So my quest should be ... Can that also be done using I2C.
Yes you can but I don't think the extended character set stored in the the LCDs ROM is directly mapped to the one on you pc so the easiest way I can think of is to just to create a character array containing the ROM codes for the characters you want to print. I've pasted below an example for Omega and Pi:

  1. #include "SmartLCDI2C.h"  
  2.  
  3. #define I2C_ADD 0x27      
  4.  
  5. SmartLCD SmartLCD(I2C_ADD);
  6.  
  7.  
  8. char omega[] = {0b11110100, '\0'};
  9. char pi[] = {0b11110111, '\0'};
  10.  
  11. void setup()
  12. {
  13.   SmartLCD.init();
  14.   SmartLCD.Clear();                
  15. }
  16.  
  17.  
  18. void loop()                
  19. {  
  20.   SmartLCD.Print("Omega: ");
  21.   SmartLCD.Print(omega);  
  22.  
  23.   SmartLCD.CurPos(1, 0);  
  24.   SmartLCD.Print("Pi: ");  
  25.   SmartLCD.Print(pi);
  26.  
  27.   while(1);
  28. }
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

RetroBoy
Posts: 73
Joined: Sat Feb 26, 2022 11:29 am
Location: U.K.

Re: How to print Extended ASCII codes and Greek Characters i.e: OMEGA, DELTA,etc using I2C and HCMODU0163

Post by RetroBoy » Thu Mar 17, 2022 7:27 pm

Hi Andrew.
What I expected. I have the A00 & A02 Code pages printed so as you suggest that will be the easiest way. Nice to know that where there is a will there is a way.

Post Reply

Return to “General Discussion”