|
|
View previous topic :: View next topic |
Author |
Message |
lakeboy
Joined: 16 Apr 2007 Posts: 1
|
Touchscreen control |
Posted: Mon Apr 16, 2007 5:48 am |
|
|
Hi all,
i'm a new member and a beginner in pic C programming,so i hope that you can help me...
i just want some advise on how to control a touchscreen lcd by a pic via rs232.I need to detect which touch field is pressed in a certain moment ;when a field is pressed, lcd responses are like these: K [A7] [ACK] ......K [B5] [ACK].......K [C2] [ACK].......etc, where K is the ascii code of 'K' , [ACK] is the acknowledge (hex 06), and the other byte (i.e. [B5] ) is the hex code of the specific pressed key, and I'd like to capture this byte and fit it into an array. How can i do?? Thanks! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Apr 16, 2007 12:38 pm |
|
|
This is the familiar task of receiving messages, which have markers
for the beginning and ending of the messages, and then parsing the
data. There are many ways to do this, but one way is to use the
CCS example file, Ex_Sisr.c, to make an interrupt-driven receive buffer.
The code in the #int_rda routine might also have some smarts in it,
rather than just being a simple buffer filling routine. It might look
at the incoming characters and set a flag to show that at least one
complete message is available in the RS-232 receive buffer.
Then in your main() code, you can poll this flag. If it's set, then
you can extract the message from the receive buffer, by using the
bgetc() routine in Ex_Sisr.c. You can copy the message to a local
array, and then call another routine to parse the message and return
the data in some form that's usable to your program, such as integer
values that can be put into an array. |
|
|
|
|
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
|