Newhaven Display Forum

Newhaven Products => Character LCDs => Topic started by: kayasaman on August 06, 2019, 05:42:14 AM

Title: Command structure for NHD-0220D3Z-FL-GBW-V3
Post by: kayasaman on August 06, 2019, 05:42:14 AM
Hi,

I'm trying to send commands to my display using a terminal to learn about how the command structure works so I can create a driver for it in Lcdproc.

Currently I am unable to get anything working. Using drivers for different manufacturers I can tell the displays are fine and working as characters do appear on them even though they are just random.

I have looked at the sample code provided: https://www.newhavendisplay.com/app_notes/Serial_LCD.txt

Especially this part:

Code: [Select]
/********************************************************************
 lcd clear
********************************************************************/
void lcd_clear(void)
{
tx_packet[0] = 0xFE;
tx_packet[1] = 0x51;
send_packet(2);
delay_ms(10);
}


My setup is as follows:

I have a 3x Pine64-LTS boards with TTL to RS232 shifters installed then linked to 3x displays, two of which are green/yellow and the other is white/blue but model numbers are same just different color screen.

I am running Armbian (Debian based Linux) on one of the Pine's and FreeBSD 13-CURRENT on the other two Pine's.

The display's are all set to RS232 mode with both R1 and R2 open. Pin 3 is connected to GND, Pin 2 is +5V and Pin 1 is the RS232 signal
(http://www.newhavendisplay.com/specs/NHD-0220D3Z-FL-GBW-V3.pdf)


At the moment I am trying to use the 'echo' program to clear the screen. This is what I have tried:

Code: [Select]
echo -en "\xfe\x51" > /dev/ttyS2

Additionally I have tried to modify a Perl program to talk to the display and for now just clear the screen:

Code: [Select]

#!/usr/bin/perl -w
open(LCD,">/dev/ttyS2")||die "ERROR: can not write to /dev/ttyS2\n";
$|=1;
my $i=0;
while(1){
    $i++;
    print LCD chr(0xFE),"51"; # clear the display
# print LCD chr(0xFE), chr(0x51);   
#    print LCD "Count $i\n";
    sleep(1);
}
close LCD;

Again it isn't working :-(

What do I have to do to send the: 0xFE 0x51 command to clear the screen?

Thanks.
Title: Re: Command structure for NHD-0220D3Z-FL-GBW-V3
Post by: kayasaman on August 07, 2019, 08:03:57 AM
Here are some images of the project with the displays.

If anyone knows of a way to throw commands at the displays without needing to compile a full C program it would be great. Currently sending Hex codes to the displays don't seem to work so if somehow I could just clear the screen to start with then produce some characters then text on the display it would be great.
Title: Re: Command structure for NHD-0220D3Z-FL-GBW-V3
Post by: Ted_M on August 09, 2019, 04:59:18 PM
Please confirm the RS-232 signal driving the display is 5V TTL .

Best Regards,
Title: Re: Command structure for NHD-0220D3Z-FL-GBW-V3
Post by: kayasaman on August 09, 2019, 05:41:57 PM
Quote
Please confirm the RS-232 signal driving the display is 5V TTL .

The display is being driven at 5V. The documentation says RS232. My level shifter is converting the uart port on the Pine64 which is a 3.3V TTL signal to 5V RS232.

Perhaps there is confusion here as RS232 is not the same as TTL though the documentation for the display clearly says RS232.... therefor if the display should be driven at 5V TTL then it is not RS232.

I can try with a TTL signal of 5V but I will need to find a converter to amplify the 3.3V signal from the pin and bring it up to 5V.
Title: Re: Command structure for NHD-0220D3Z-FL-GBW-V3
Post by: kayasaman on August 10, 2019, 12:59:13 PM
What I am using at present is this:

https://www.artekit.eu/ak-3232-usage-guide/

It is taking the 3.3V uart signal from the Pine64 and translating it to full swing -5V - +5V RS232.

If it is TTL that I need to send to the display then I will need to convert the RS232 signal to 5V TTL which will then range between 0V - +5V.

One attachment I have included shows the "level shifter" on the right hand side (small square) and the other illustrates the differences between TTL and RS232 levels taken from the link above.
Title: Re: Command structure for NHD-0220D3Z-FL-GBW-V3
Post by: kayasaman on August 11, 2019, 04:56:09 PM
I managed to figure this one out!  :D

It is indeed a TTL signal that the display needs and *not* RS232!

Perhaps it would be a good idea to change the documentation as that threw me off totally  ;)

Throwing a few commands at the display and getting results now  :D :D

Although the voltage is 3.3V TTL at present for this quick test.

What actually is needed for me so that I don't strain the display is a level shifter and not converter; another words not a board which takes the input TTL signal and then goes full swing RS232.

I think this is what I'm looking for: https://www.artekit.eu/products/breakout-boards/ak-txs0108-v2-bidirectional-level-converter-breakout/

which should take the 3.3V TTL input from the Pine and amplify it to 5V TTL output for the display. I'm just confirming it currently with the Artekit guys though there are many different brands available - SparkFun being another.

Now I can at least start working a driver for Lcdproc so that I will be able to get my GPS's NMEA sentances, NTP information and other useful output on the display.