Uart input in char array save

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

cross mob
MaKo_4670821
Level 1
Level 1

Hi everyone,

I Need your help. I started to work with PSoC 5LP and I want to have a terminal set up with UART.

If I press T hh:mm  = sets the current time for the device      and if I write T? = prints the current device time.

How i get the Output, i have a Char for the Input of the terminal?

Char= UART_GetChar();

but not a Char Array... I don't know how to change it.

Thanks a lot.

Best

Marcel

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear Marcel-san,

Could you take a look at some of my sample programs,

if they can be any help?

Re: tty_utils a utility sample for CLI type program

MCU Tester, a Swiss Army Knife for PSoC (CY8CKIT-059 version)

Best Regards,

5-Jun-2020

Motoo Tanaka

View solution in original post

0 Likes
3 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi Marcel,

There is no direct API to read the string in PSoC 5.

To read the character array you can use a While loop with UART_GetChar(); API inside and continuously read it until you find a valid character.

You can use a separate character array in the firmware to store the characters those have been read.

You can termiate the polling of UART_GetChar(); process until you read an "enter" from the terminal.

In case if you dont want to waste time with polling, you can use an interrupt which triggers on receiving a byte in the RX buffer. In the ISR you can read the characters entered and decide them if they are valid/not/string terminated(enter) and take necessary action.

Hope this helps !

Thanks

Ganesh

0 Likes

Hi GaneshD_41,

first I want to thank you for an answer.

Since I still don't know how to do this, I wanted to ask if you had a sample program in such a form where I could take a closer look at it?

That would certainly help me with my problem.

Thank you very much for helping me!

Best

Marcel

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear Marcel-san,

Could you take a look at some of my sample programs,

if they can be any help?

Re: tty_utils a utility sample for CLI type program

MCU Tester, a Swiss Army Knife for PSoC (CY8CKIT-059 version)

Best Regards,

5-Jun-2020

Motoo Tanaka

0 Likes