Holding the response event from Touch region

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
Eddy
LCD?
Posts: 6
Joined: Mon Nov 07, 2016 11:15 am

Holding the response event from Touch region

Post by Eddy » Mon Nov 07, 2016 11:42 am

Hello,

I am using a GLT240128 Rev 8.4, PCB Rev 1.0 with RS232 protocol @ 19.2k baudrate.
Every time i press the defined region, a response is sent back immediately, no problem there.
I tried using Hardware Flow Control with 14bytes buffer and/or disabling auto-transmit off to
enter polling mode. It doesn't work, the response always sent from the TX pin of the GLT240128 instantly.

I would like to be able to poll the Pressed Key in a buffer in a FIFO manner, but it doesn't work.
Programming language C.

Eddy.

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 78
Joined: Thu Sep 24, 2015 9:38 am

Re: Holding the response event from Touch region

Post by Daniel Divino » Mon Nov 07, 2016 2:32 pm

Hello Eddy,

Welcome to the forums!

I understand you are looking for a method to poll touch response data from your GLT240128, rather than have the responses automatically transmit to your host.

If you enable hardware flow control on the display, you will be able to control when data is returned from the display by manually controlling the RTS pin on your host side.

Hardware flow control is a form of handshaking between the display and the host. With flow control enabled, your display will hold information until the host requests for data. By manually controlling the RTS pin on your host, you can control when the display sends data/touch responses.

Below are a few links with details on how to control the host's RTS pin written in C on windows:
http://stackoverflow.com/questions/1853 ... s-platform
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Cheers,
Daniel
Daniel Divino
Technical Support
Matrix Orbital

Eddy
LCD?
Posts: 6
Joined: Mon Nov 07, 2016 11:15 am

Re: Holding the response event from Touch region

Post by Eddy » Mon Nov 07, 2016 2:51 pm

Hello Daniel,

Thank you for the quick reply from email AND forum.
The suggested method is what I was looking for!!

I will let you know how it went.

Thanks!!

Eddy

Eddy
LCD?
Posts: 6
Joined: Mon Nov 07, 2016 11:15 am

Re: Holding the response event from Touch region

Post by Eddy » Tue Nov 08, 2016 11:40 am

Hey Daniel,

It went great!! I now have control over the flow.

Set the Flow Control Mode to Hardware, // see ctrl cmd 1.5
Set the Flow Control Trigger Level to 3 // see ctrl cmd 1.6 ,
Clear RTS pin (Host to GLT240128) // Holding data,
do stuff... LCD gets press events....
delay_3sec
Set RTS pin (Host to GLT240128) // Request to Send
delay_3sec
Clear RTS pin (Host to GLT240128)

However the unit acts like it freezes after a few seconds, I believe it has something to do with the
2nd line " Set the Flow Control Trigger Level to 3 "

Any suggestion?

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 78
Joined: Thu Sep 24, 2015 9:38 am

Re: Holding the response event from Touch region

Post by Daniel Divino » Wed Nov 09, 2016 8:31 am

Hello Eddy,

Command 1.6 Set Hardware Flow Control Trigger shouldn't take a significant time to execute. Does your programming software allow for breakpoints during operation? You may be able to run through each line of the code and determine which line(s) are taking time for execution.

When running the program, is there any pattern to the unit freezing? Does freezing occur immediately after you touch the display?

Is it possible for you to reduce the delays in your code?

Daniel
Daniel Divino
Technical Support
Matrix Orbital

Eddy
LCD?
Posts: 6
Joined: Mon Nov 07, 2016 11:15 am

Re: Holding the response event from Touch region

Post by Eddy » Wed Nov 09, 2016 9:45 am

Hey Daniel,

Ahhh It was actually a problem on my end, somehow i added a Clear Screen AFTER I just wrote the new text in my Refresh Display Interrupt Sub Routine. However, about the Flow Control Level Trigger Level 3 (14 bytes) can you explain a bit more on what is the meaning of 14bytes? Do i have to clear some sort of buffer or reset anything after 14 bytes...? I added that command because the Level 0 (1 byte ) wasn't reassuring as I have up to 4-5 Press Events to receive. Thank you for your time and concern!!

cheers!

Eddy

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 78
Joined: Thu Sep 24, 2015 9:38 am

Re: Holding the response event from Touch region

Post by Daniel Divino » Wed Nov 09, 2016 10:23 am

Hi Eddy,

It's good to hear you were able to resolve your display freezing issues.

The Set Hardware Flow Control Trigger Level command is used to adjust how much the display's buffer can fill up before it deactivates the Clear to Send Line.

To explain flow control a little further, when Hardware Flow control is enabled the host will check if it is Clear To Send data to the display. If CTS is high, the host will send data to the display. These commands get stored in the display's buffer, and the the display begins to execute each command it receives. Once a command is executed, it is removed from the display's buffer.

The buffer is required to ensure that no command is missed if it is sent while the display is processing a command. In addition, because certain commands take longer to execute than others, it will not be able to execute each command immediately when it is received especially communicating at high speeds.

As more commands are received, the display's buffer will fill, until eventually it cannot hold any more commands. At that point, the display will deactivate the CTS line, letting the host know to not send any more data until there is more space.

If the hardware flow control is set to 3, the display will deactivate it's CTS line when there are only 14 bytes free left in the buffer. Level 0 will deactivate the CTS line when only 1 free byte is available in the buffer.

Hopefully this clarifies command 1.6 for you.

Daniel
Daniel Divino
Technical Support
Matrix Orbital

Eddy
LCD?
Posts: 6
Joined: Mon Nov 07, 2016 11:15 am

Re: Holding the response event from Touch region

Post by Eddy » Wed Nov 09, 2016 11:00 am

Hi Daniel,

Thank you for the well explained clarification and with examples!!
Because I read on other posts that even at 115k Baudrate it will be hard to saturate the 128 bytes buffer of the unit.
So I was a little confused. Also it confused me to limit the holding bytes up to 14, but not anymore now that it is explain.

Once my code is fixed, ill reply this post with a shorten version of how to use the Flow Control with others.

cheers!!

Eddy

Eddy
LCD?
Posts: 6
Joined: Mon Nov 07, 2016 11:15 am

Re: Holding the response event from Touch region

Post by Eddy » Thu Nov 10, 2016 9:10 am

Hey Daniel,

It is now fully operational. Here's my code basically.

Init();

LCD_Clear();

LCD_Write_char(0xFE); //
LCD_Write_char(0x3F); // CTRL CMD
LCD_Write_char(0x02); // HW Flow Control Enabled.

LCD_Write_char(0xFE); // HW Flow Control Trigger Level.
LCD_Write_char(0x3E); // Pas inscrit dans le manuel mais c'est que le gr.LCD possede 128bytes de buffer
LCD_Write_char(0x03); // LEVEL 3 => Will Clear GLT240128's RTS pin when only 14 bytes free left in buffer

LCD_Write_char(0xFE); // make response protocol to be serial
LCD_Write_char(0xA0); // most likely already serial but just in case.
LCD_Write_char( 1 );

__delay_ms(5);
do stuff.....
RTS_ON(); // ready to receive data from GLT240128 => (component J12, PIN_CTS will be SET)
__delay_ms(1); // 1 byte @ 19.2kBaud takes around 0.47ms, for now it's one byte but will adjust delay depending on how many bytes needed.
/* No manual serial handler since i'm using RS232 ISR to receive data*/
RTS_OFF(); // force GLT240128 to hold data while i'm not ready... GLT240128 => (component J12, PIN_CTS will be CLEARED)
continue program.....

PS: I noticed sometimes the unit does not make appropriate changes on commands that is set on (remember when on).
Take for example, I set it to Hardware Flow Control then change Flow Control to NONE after but it doesn't change anything, I have to unplug power and replug power for it to reset. Don't know if it was intentional or not, but i thought new command would overwrite the first configuration.

Sorry as i cannot post my real code for work reasons.

cheers!!

Eddy

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest