Previous in Forum: RFID Tags   Next in Forum: Filtering Phone Calls
Close
Close
Close
7 comments
Rate Comments: Nested
Member

Join Date: Jan 2013
Posts: 6

MCU UART Communication with Touch Screen

01/21/2013 5:54 AM

Dear All,

I am working with 16 bit MCU for communicating with a TC through a serial Port I have one problem when sending commands from mcu to tc, ie,i want to send a command like "?01SRW000615F"from mcu to TC for that I wrote a code, when testing in hyperterminal its working,but when connecting to TC its not working means no response from TC,but the same code in hyperterminal when pressing enter its passing to TC, its works.I dont know why MCU not sending to TC,

I found out one thing is when pressing enter in hyperterminal then only this command send to TC so add a'\r' in my program then also not working.

Normally MCU transmit one charater at a time,may be this is the issue,anyone have idea how to send a bunch of charaters at a time. Plz help me to find a solution.

All the commands I used in the program are right.

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru

Join Date: Aug 2007
Location: Earth - I think.
Posts: 2143
Good Answers: 165
#1

Re: MCU UART Communication with Touch Screen

01/21/2013 11:57 AM

The most common mistake in RS-232 communications is handshaking. Pleas read something like this: http://www.windmill.co.uk/handshaking.html to get an understanding of the principles.

If you can send a character string from hyperterminal to the touch screen successfully, then either the MCU is not sending the same string (read the manual), or the MCU is being told to not send (handshaking).

Bring up the hyperterminal session that you used to talk to the touch screen, and check the flow control settings in the configuration. It will either be set to software (XON/XOFF), or it will be set to hardware (RTS/CTS).

To answer another question from your duplicate thread: http://cr4.globalspec.com/thread/82536#comment914906

STX stands for Start of TeXt ; this signals the receiving device that a message (usually of indeterminate length) is beginning, and the end of that same message is denoted by sending an ETX (End of TeXt).

__________________
TANSTAAFL (If you don't know what that means, Google it - yourself)
Register to Reply
Member

Join Date: Jan 2013
Posts: 6
#2

Re: MCU UART Communication with Touch Screen

01/21/2013 11:29 PM

Thanks for your reply,but I can able to send commands from TC to MCU,this is working reverse is not working , as per this is it flow control issue.I want to send command like this ?01SRW000615F without having STX & ETX etc then only TC responds, normally I know we are using STX at the begining & ETX at the end here it is not possible,so let me know any other solution or if you want i can send my code.

Register to Reply
Guru

Join Date: Aug 2007
Location: Earth - I think.
Posts: 2143
Good Answers: 165
#3
In reply to #2

Re: MCU UART Communication with Touch Screen

01/22/2013 11:17 AM

You said: "Thanks for your reply,but I can able to send commands from TC to MCU,this is working reverse is not working ".

Apparently you missed where I said: "then either the MCU is not sending the same string ". That means that I KNOW your problem is SENDING FROM THE MCU TO THE TOUCH PANEL.

STX/ETX and flow control are 2 separate issues.

CHECK OUT THE FLOW CONTROL.

Unsubscribes in disgust

__________________
TANSTAAFL (If you don't know what that means, Google it - yourself)
Register to Reply
Anonymous Poster #1
#4

Re: MCU UART Communication with Touch Screen

01/22/2013 2:45 PM

Have you checked with your MCU vendor to see if they already have Serial Communication routines you can use or compare yours to?

Register to Reply
Member

Join Date: Jan 2013
Posts: 6
#5

Re: MCU UART Communication with Touch Screen

01/23/2013 10:38 PM

Thanks everyone ,now its working.I have some doubts in embedded c programming,I have a sample code work for Renesas R8C/26-R5F2127 mcu, in this they used as for eg. with extern keyword.
union byte_def byte_flag_0;
union byte_def byte_flag_1;
union byte_def byte_flag_2;
#define bf_timeup_1ms byte_flag_0.bit.b0
#define bf_timeup_10ms byte_flag_1.bit.b0
#define bf_timeup_100ms byte_flag_2.bit.b0 like this, what does this means,I think they defined each variable with a bit.But my main doubt is from where this byte_flag is getting a value,in that program there is no option to get a value, they simply mention 2 condtions like if (bf_timeup_1ms) or else. What does this means.Plz help me.
Purpose of this program is TX & RX.

Register to Reply
Anonymous Poster #1
#6
In reply to #5

Re: MCU UART Communication with Touch Screen

01/24/2013 12:23 PM

somewhere you have a union defined with the name "byte_def".

unions are used to overlay memory references of different types to the same memory location.

if you find the definition, it probably has a byte type defined, and a bit structure overlayed, called "bit" which has fields b0, b1, to b7

so references to byte_flag_0 will have the . operator and either the byte label to refer to the whole byte (as a byte type), or the bit.bx style, referring to an individual bit, (as a bit type)

remember, those #define are only text substitution, so if you see:

if (bf_timeup_1ms) ...

it is pre-processed to

if (byte_flag_0.bit.b0) ...

which will evaluate true if the bit is set, false if not.

Register to Reply
Member

Join Date: Jan 2013
Posts: 6
#7
In reply to #6

Re: MCU UART Communication with Touch Screen

02/05/2013 11:09 PM

how this bit is set,because manually there is no option in program to get a value for that byte.

Register to Reply
Register to Reply 7 comments

Previous in Forum: RFID Tags   Next in Forum: Filtering Phone Calls

Advertisement