Al momento, stai seguendo questa domanda
- Vedrai gli aggiornamenti nel tuofeed del contenuto seguito.
- Potresti ricevere delle e-mail a seconda delle tuepreferenze per le comunicazioni.
Reading ADC data from MSP430 to Matlab via serial port
- setup serial communication.
- create array to store uart values
- calculate voltage values
- plot live values
19 Commenti
- I haven't yet experimented this circuit on the workbench where i will apply known strain to test my circuit so I don't think I have limit to specific number of samples needed. Lets assume I will be watching matlab data and plot while experimenting so I have not clear answer for this.
- the data from adc is sampled channel by channel so I am taking data from ads as 1 sample per channel and then proceding to next channel.
- this means that i am trasnferring data to serial port in above mentioned way.
- If i want to record it i first have to seperate data which UART is pushing out as 8 bit(adc samples 24 bit of data for single sample) hence I would have to record 4 byte and sort it into 1 row and then switch to another row to record one more sample ..........
- Write numbers in character form, either decimal or hexadecimal, with non-number between the entries. Either put newline after each individual number or put newline at the end of a group of samples; or
- Write numbers in binary using a fixed number of bytes per entry, so that you can ask to read a fixed number of bytes with no delimiter; or
- At the beginning of each burst of numbers, write a byte (or two) which is the number of bytes that follow in that packet, with no end of line. The input side reads the size (fixed size) and uses the size to read that many bytes; or
- use a variable length binary stream with a fixed termination byte, with the binary stream having been carefully adjusted so that it never accidentally includes the termination character. For example you might use newline, and everywhere that newline would have been sent as data send 255 0 and everything 255 would have been sent, send 255 255.
- you can continue to send in binary, and do binary reads using fread() (for serial) or read() (for serialport). If you are not always sending the same number of bytes or if not everything is the same binary data type, then you may need to add some extra bytes to indicate how the following data is to be treated. If you use this fread() binary approach, you do not put any delimiters between values and you do not send newline; OR
- you can switch to sending the numbers as text. If you send as text, put a space between the values and put newline at the end of the line. On the MATLAB end, fscanf() will read the entire line of values, returning a numeric vector.
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Si è verificato un errore
Impossibile completare l'azione a causa delle modifiche apportate alla pagina. Ricarica la pagina per vedere lo stato aggiornato.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia-Pacifico
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)