David_
Advanced Member level 2
- Joined
- Dec 6, 2013
- Messages
- 573
- Helped
- 8
- Reputation
- 16
- Reaction score
- 8
- Trophy points
- 1,308
- Location
- Sweden
- Activity points
- 12,242
Hello.
This thread is kind of the next step in a project based on what is discussed in https://www.edaboard.com/threads/325824/ which is about a USB-RS232 dongle.
Now I have that part taken care of, for now I am talking to a Arduino Due through its on-board ATmega chip which in turn talks to the PC through USB but I might(in time I will) switch to a solution with DTR/DSR, RTS/CTS but that don't impact this subject much(I think).
First of, I'm not looking for a matlab specific solution but rather a general principal for how to do it when dealing with serial communication to PC's.
I am running Matlab on my laptop and use it to fetch ADC data from the Due(SAM3X8E), its the Due's internal 12bit ADC but in the end I will have a external 16bit ADC. But my current software allows me to send a string to the Due from Matlab in order to request certain things.
Like if I send "read|A0|200|" the Due will read the ADC channel A0 and send its result through serial with a blank space after and the have a delay of 10mS 200 times, after which a CR/LF is sent.
I can't request more than 1000 values because Matlab's variables don't allow me to store more than that and I am know trying to set up a continuous communication that analyses and plots the results as the new values comes in.
But I don't know how to do such a thing, does any one have any advice?
I am really stuck and I appreciate any and all inputs, if my current solution is of interest to see I can elaborate.
One other subject that is relevant to this thread is the most efficient way to send values over 255, I am sending 12bit values a 0-4095 but later it will be 0-65536.
Regards, David_
This thread is kind of the next step in a project based on what is discussed in https://www.edaboard.com/threads/325824/ which is about a USB-RS232 dongle.
Now I have that part taken care of, for now I am talking to a Arduino Due through its on-board ATmega chip which in turn talks to the PC through USB but I might(in time I will) switch to a solution with DTR/DSR, RTS/CTS but that don't impact this subject much(I think).
First of, I'm not looking for a matlab specific solution but rather a general principal for how to do it when dealing with serial communication to PC's.
I am running Matlab on my laptop and use it to fetch ADC data from the Due(SAM3X8E), its the Due's internal 12bit ADC but in the end I will have a external 16bit ADC. But my current software allows me to send a string to the Due from Matlab in order to request certain things.
Like if I send "read|A0|200|" the Due will read the ADC channel A0 and send its result through serial with a blank space after and the have a delay of 10mS 200 times, after which a CR/LF is sent.
I can't request more than 1000 values because Matlab's variables don't allow me to store more than that and I am know trying to set up a continuous communication that analyses and plots the results as the new values comes in.
But I don't know how to do such a thing, does any one have any advice?
I am really stuck and I appreciate any and all inputs, if my current solution is of interest to see I can elaborate.
One other subject that is relevant to this thread is the most efficient way to send values over 255, I am sending 12bit values a 0-4095 but later it will be 0-65536.
Regards, David_