11/19/2023 0 Comments Psoc creator receiving string data![]() For this example, it is USBUART, and in the default location. (Menu File->New) Pick the CY8CKIT-059 as the target. ![]() (For completeness, regarding using a debug serial port, see note 1 at the bottom of the post.) Implementation Details: Your USB Projectįirst, create a new project. Fortunately, Cypress has done 99% of the work for you within PSoC Creator 4.2, when using the USB component. This can easily be accomplished through the PSoC 5’s USB port. In those cases, I like to combine the ability to power my project with 5 Volts with a communication path into my code. Hopefully the new forum will take care of some of the problems.When working on a project, it is often useful to have the ability to peek into the world of the processor. ![]() I would like to put sample code for you but this forum sucks. Then you will need to convert these results to the proper data type (perhaps float). (Perhaps 2 bytes into a 16 bit register or 4 bytes into a 32 bit register) This will involve bit shifting and "anding" or "oring" depending on how you do it. You need to determine where the data starts in your message and capture the correct bytes in the correct order then insert them into a data type of the correct type. Anything larger than 8 bit will need to be reassembled and converted into its proper data type. Then you process the array using CRC and if it is a valid message, you look for the start delimiter (Might be IP address or MAC address or Modbus address or just a specific character or group of characters.įrom this point you will fill your structure with the data. The entire uart frame will go byte to byte into the DataIn Array. You will need a timer for this or a counter. There is always a start delimiter of some sort to tell you when the message starts. If you are writing your own program Id suggest using a existing protocol of some sort. You need to know what protocol the data is in and adjust your structure to accept it. (uint8 DataInString )There are many ways to do this but if you know your frame size it is eaisiest. You need a array to put your data from the uart. Remember to always disable the UartRx interrupt when you access the Uart.Then enable it after you fetch data. Then you need to make functions that will fill the structure You will have a lot of data and need somewhere to store it. Whatever you sent will be long gone covered by errant noise bytes by the time the delay is over.įirst, you need a structure to store your data. Your CyDelay(2000) will corrupt everything. ![]() User Code is up to you.įirst of all forget everything you read in the Cypress Uart datasheets. It does however initialize and create functions for the components. I could not get it printed in hyperterminal.Ĭreator dosent have any lists of functions. NB: I just printed the string in LCD to detect if I am really receiving the data. LCD_Char_1_WriteControl(LCD_Char_1_CLEAR_DISPLAY) ![]() But I am not able to access the string 'message' divide it by 1000 and proceed. Then read the value 45 and display if it is high or low. Then understand it is node 1 from quotient and againg divide 345 by 100 to identify it is sensor 3. I mean I have to divide 1345 with 1000 and find quotient and the remainder. I have to extract the data node 1, sensor 1 value 45 from it. The variable 'message' is string.For eg It will be of the form 1345.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |