How to accept data from a USB to RS232 converter to MATLAB and storing the data to a variable
Show older comments
Hello everyone, I'm using an ATMega8 Microcontroller ADC to convert the output of a photodiode to digital form. This digital data I've stored in a register of ATMega8. My requirement is to transfer the data from the ATMega8 register to a MATLAB variable.
I'm using a Laptop with two USB ports but no serial/parallel port. I cannot affort to use a DAQ or some custom solution for this purpose. Thus I think my only option is to use a USB to RS232 converter. Data is output from the microcontroller in serial format.
Here's what I understand:
- Data is stored in one of the registers of ATMega8. This is in hexadecimal.
- I place the data to be communicated in the UDR (UART Data Register) register of ATMega8.
- Data is transmitted through the Tx pin of the microcontroller in serial format.
- My USB to RS232 converter converts the serial data from the microcontroller to USB format.
- The USB end of the converter is connected to my PC.
- Data received at the USB port will be in a different format from the serially communicated data.
How can I get this data from that converter? I need to store the Hexadecimal value of the received data to a variable in MATLAB.
Would it be easier to use C/C++ to receive data and import it to MATLAB?
Once again, I cannot use a DAQ. The USB to RS232 converter isn't a supported brand. Its lika a homemade converter.
So is there a MATLAB solution for this? What should I do?
Accepted Answer
More Answers (0)
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!