UART Communication

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Hello,

   

 

   

I am using two UARTs in my system.One UART is for transmission and one UART is reception in duplex mode.

   

 

   

Here is a part of my Program

   

   

for(;;)

   

    {

   

        /* Place your application code here. */

   

//Wait for command

   

recv_byte=0;

   

UART_1_WriteTxData(0x0d);UART_1_WriteTxData(0x0a);

   

UART_1_PutString("Company Name.......");

   

         CyDelay(20);UART_1_WriteTxData(0x0d);CyDelay(20);UART_1_WriteTxData(0x0a);

   

CyDelay(20);UART_1_WriteTxData(0x0d);CyDelay(20);UART_1_WriteTxData(0x0a);

   

UART_1_PutString("auoto Zero  => Z");

   

          CyDelay(20);UART_1_WriteTxData(0x0d);CyDelay(20);UART_1_WriteTxData(0x0a);

   

UART_1_PutString("Measure     => M");

   

       CyDelay(20);UART_1_WriteTxData(0x0d);CyDelay(20);UART_1_WriteTxData(0x0a);

   

UART_1_PutString("Setup       => S");

   

        CyDelay(20);UART_1_WriteTxData(0x0d);CyDelay(20);UART_1_WriteTxData(0x0a);CyDelay(20);

   

UART_1_PutString("display oN  => N");

   

         CyDelay(20);UART_1_WriteTxData(0x0d);CyDelay(20);UART_1_WriteTxData(0x0a);CyDelay(20);

   

UART_1_PutString("display oFf => F");

   

         CyDelay(20);UART_1_WriteTxData(0x0d);CyDelay(20);UART_1_WriteTxData(0x0a);CyDelay(20);

   

UART_1_PutString("display Test=> T");

   

         CyDelay(20);UART_1_WriteTxData(0x0d);CyDelay(20);UART_1_WriteTxData(0x0a);CyDelay(20);

   

CyDelay(20);

   

.

   

.

   

.

   

.

   

.

   

so on.............and I am displaying all these datas through serial port in Hyperterminal in a PC

   

the problem that now I am facing is,there is only one or two lines is displaying or transmitting.After that the execution of the program is in a Pause state.

   

 

   

Can anyone please tell what is the reason for this problem ?

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Would you mind to zip and post your complete project here, so we can have a look at all possibilities that cause your problem?

   

If you "Clean" your project before zipping it becomes smaller, there is a 2MB limit for uploads afaik.

   

Bob

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

At (very) first sight I can see, that you use the WriteTxData() API without checking the transmitter status. This will resullt in errorneous transmission of data..

   

What are your Delays for? Waiting until the data is transmitted? It will go better checking the status.

   

Use the PutChar() API instead, which will block, if the UART is busy or the transmit-buffer / FiFo is full.

   

The PutString() API already blocks, so there's no need to wait for it.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi every body! Help me!!!

   

I have a prolem when PSoC conect to PC via RS232 circuit (UART).

   

I need:

   

- PSoC recieve data from PC send (char,string...).

   

- If PSoC receive character 'a', turn on led; else turn off led.

   

Pin:

   

P0.4: RX

   

P0.5: TX

   

P0.3: led

   

Currently, hardware is fine. But code not work as i need!

   

I checked configuration PSoC, code of my project.

   

I upload my project for every body.

   

Can you help me, please?

   

I do this project because i will do project: 

   

-P0.4 receive data (char, string...) from pC.

   

-P0.5 forward data that P0.4 received to PC.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Just a check, you have a RS232 transceiver connected to your PSOC

   

to develop RS232 levels for the PC serial interface ?

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I see you are driving LED by setting port to high, implying LED wired from Vss to

   

a series R to pin. The pin cannot source as much current as sink, better you connect LED

   

to Vdd to series R to port, and turn it on driving pin to "0", Vss.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hi Dana,

   

About RS232 circuit which i used: it is good because i coded a example to test.

   

- TX on PSoC transmit data (char, string) to PC, PC received data and show well.

   

- But RX on PSoC can't work. 

   

(I'm using software: Terminal 1.9b to check communication between PSoC and PC)

   

I use 1 led to test, not more. I think project has no prolems with that led.

   

Can you check about configuration of my project, please?

   

Or, Is code incorrect?

   

I have just studied PSoC!

   

Many thanks!

   

 

0 Likes