PSOC HC-05 communication

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

cross mob
CaDu_3933941
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

Hi all,

I am currently working on an RC car for which my wireless communication module is an H-05. The kit I am using is the CY8CKIT-059. I have never used them before but so far I have managed to pair them. I am currently trying to try something simple to test like driving an LED on the other board. So far I have been unsuccessful. I do not know how to attach a project so I will attach the code and some pictures which should be enough.

Transmitter:

pastedImage_1.png

/* ========================================

*

* Copyright YOUR COMPANY, THE YEAR

* All Rights Reserved

* UNPUBLISHED, LICENSED SOFTWARE.

*

* CONFIDENTIAL AND PROPRIETARY INFORMATION

* WHICH IS THE PROPERTY OF your company.

*

* ========================================

*/

#include "project.h"

int Rx;

char str;

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_1_Start();

    for(;;)

    {

        if(BTN_Read()==0){

            UART_1_PutChar(100);

            Pin_1_Write(1);

        }

       

        else{

            UART_1_PutChar(100);

            Pin_1_Write(0);

        }

       

       

       

       

    }

}

/* [] END OF FILE */

Receiver:

pastedImage_4.png

/* ========================================

*

* Copyright YOUR COMPANY, THE YEAR

* All Rights Reserved

* UNPUBLISHED, LICENSED SOFTWARE.

*

* CONFIDENTIAL AND PROPRIETARY INFORMATION

* WHICH IS THE PROPERTY OF your company.

*

* ========================================

*/

#include "project.h"

uint8_t Rx;

char str [120];

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_1_Start();

    for(;;)

    {

       

        Rx = UART_1_GetChar();

        UART_1_PutChar(Rx);

       

    }

}

/* [] END OF FILE */

Any help is appreciated.

Thanks

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

GetChar()  api will return a 0x00 when no data is present. Better use GetData() API and check the upper byte for status info.

To upload a project:

Use Creator->File->Create Workspace Bundle and attach the resulting .zip (using advanced editor)

Bob

View solution in original post

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

GetChar()  api will return a 0x00 when no data is present. Better use GetData() API and check the upper byte for status info.

To upload a project:

Use Creator->File->Create Workspace Bundle and attach the resulting .zip (using advanced editor)

Bob

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

I do not see that GetChar as part of the API for UART. I am currently trying to send a string from the transmitter and read it on the terminal (Teraterm) at the receiver.

I am attaching the projects.

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

Made some changes, be careful not to overwrite your recent work due to same filenames.

Are you feeding the Tx enable line externally?

Bob

0 Likes

Did not know I was supposed to, what should I enable it with?

Thank you for the files!

0 Likes