Real-Time Measurement and Control

Showing results for 
Search instead for 
Did you mean: 

Re: how to convert 80000 bytes of data received via serial port into 10000 sets each having 8 bytes

Hi A Person

   I do have code for reading and writing to the serial port. Also I have fpga vi as well as real time vi (host vi)


After I write "BS" command to the fpga port from the real time vi. The data received has to be transferred back to the real time vi.I didn't use DMA FIFO. I am using interrupt routine to transfer data from the fpga vi to the host vi.


I will attach my code with this

- 4-port serial vi is my fpga vi and crio modbus example is my host vi.


Kindly open Run GC subvi from host vi to take a look at what Iam talking about.


the code which Iam going to attach you is for our previous GC in which we will receive 1000 bytes at a time and check for our required datra string and then discard it. our data willbe present at the last 1000 bytes. so basically what we have performed is just string manipulation.if our dsired string is received we willl seperate data from it.


Now my problem is i have to alter the code in such a way that i need to discard the first 10 bytes and then divide the data which i receive into sets of 8.


note: I changed "the no of bytes to receive " in my code from 1000 to 8. so that i would receive 8 bytes at a time. but there is data loss. the total no of bytes received is reduced from 80000 to 70000.


Hope you understood my problem. i am in great need of your help. kindly help me out.




@A Person wrote:

Hi Temin:


What do you have working so far?  Do you have code written to at least read data from the module?  If so, how are you doing it and are you just reading to the FPGA or are you transferring the data to the Real-Time (RT) controller through a DMA FIFO?


My recommendation would be to write your FPGA code to discard the first few bytes of data (just don't pass these first few bytes into the DMA FIFO).  Once you have read the data on your RT controller using the DMA FIFO, use array manipulation to split the data as needed.  There are a lot of array functions that should make this pretty easy once you have all of the data.


Again, let us know where you are currently and we'll try to help you out.

0 Kudos
Message 1 of 1