How to Receive 6 Bytes from UART | Cypress Semiconductor
How to Receive 6 Bytes from UART
I am currently working on a project from school.
I am using the PsoC Starter Kit 3.
I am trying to receive 6 byte from UART. I have not been able to do this and have now tryed alot in the last 20 hours.
I have another PSoC which is sending the following every sec.
Byte1 | byte2 | byte3 | byte4 | byte5 | byte6
0xAB | 0x11 | 0x22 | 0x12 | 0x01 | 0xCD
byte 2, 3, 4, 5 can contain values from 0x00 to 0xFF
I have attached a picture from my Logic Analyser showing the data:
I have several times made sure that the UART settings are the same on the receiver and sender.
Baudrate 9600 - 8 bit - no polarity - 1 stopbit - no flowcontrol - RS484 enable
I have tryed different approach with different API calls without luck. Sometimes I get some of my data in an array, but mixed up. Thats the closed I have been on a solution.
I have no Warnings on my clocks on the UART.
Anybody having done something similar and been succesfull? Running Creator 3.
Thanks in advance.
My last attempt:
* Copyright YOUR COMPANY, THE YEAR
* All Rights Reserved
* UNPUBLISHED, LICENSED SOFTWARE.
* CONFIDENTIAL AND PROPRIETARY INFORMATION
* WHICH IS THE PROPERTY OF your company.
#define FALSE 0
#define TRUE !FALSE
#define MSG_LENGHT 6
uint8 MessageReady = FALSE;
MessageReady = TRUE;
int i = 0;
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
CyGlobalIntEnable; /* Uncomment this line to enable global interrupts. */
/* Place your application code here. */
for(i = 0; i < MSG_LENGHT; i++)
dataArray[i] = (uint8)(UART_GetByte() 0x00FF);
MessageReady = FALSE;
/*  END OF FILE */