MATLAB to PSoC through UART

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

cross mob
YoDh_4795826
Level 1
Level 1

Hello.

Currently I'm working on a robot which accepts command from MATLAB and performs actions corresponding to the command. Commands are basically the speed and positions of the robot. When I try to send speed for example 127 from MATLAB to psoc, psoc just accepts first digit of 127 i.e 1. I confirmed it by using UART_PutChar command and displayed the output in MATLAB/PUTTY. I need to send the complete value from matlab to psoc. I'm new to psoc, so it'd be great if someone helped me regarding this.

I'm using PSoC 5lp and UART_GetByte to recieve the data.

Thankyou.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi YoDh_4795826

You have put only the UART_GetByte inside the forever loop. Therefore, it will not transmit anything as the code is never executed. I am attaching a modified code. Please try this out and let us know if it works.

Best regards,

Hari

View solution in original post

0 Likes
5 Replies
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi YoDh_4795826

Are you sending 127 as characters - '1' '2' '7' which is 3 bytes?

Are you using UART_GetByte recursively within the forever loop or using interrupts? Can you share the code that you are using?

You can take a look at the UART_RX example or UART_FullDuplex code examples present for PSoC 5 LP.

Best regards,

Hari

0 Likes

Hello Hari,

Sorry for the late reply, I was busy with my other project. What I'm

trying to do is send a number for example 200 from MATLAB to PSoC. I'm

using "GetByte" to receive those three digit numbers. But the problem is

PSoC is receiving just the first digit i.e 2. I'm new to PSoC, so i'm not

sure what changes needed to be made in order to receive the complete data.

Any help would be appreciated.

Regards,

Yogesh

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi YoDh_4795826

Can you share the code that you are using so that we can check it out? The simple demonstration of UART is provided in the CEs mentioned above.

Best regards,
Hari

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

Hello Hari,

Please find the attachments below. I'm new to PSoC, so I'm not sure if this

code is correct or not.

Kind regards,

Yogesh

On Fri, Oct 16, 2020 at 11:00 PM AH_96 <community-manager@cypress.com>

0 Likes
lock attach
Attachments are accessible only for community members.
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi YoDh_4795826

You have put only the UART_GetByte inside the forever loop. Therefore, it will not transmit anything as the code is never executed. I am attaching a modified code. Please try this out and let us know if it works.

Best regards,

Hari

0 Likes