create unsigned char array to get the spi data from ADC , which is connected through usb to SPI converter to matlab
Ältere Kommentare anzeigen
i am using a 24 bit ADC with SPI output, i need to interface it to MATLAB so im using MCP2210( usb to SPI converter working)
my board working and i am able to configure it.
Problem.... To receive SPI data from pc(matlab)<-converter<-ADC, i need to use TxferSpiData function in .dll of mcp2210.
below i have shown Coding in C++ to tx and Rx two 8-bit data.
how can i create this array in matlab to receive 27 bytes of data in 27 array(8 channel ADC of 24 bit resolution) , i have used cell to receive it not working.
i have added my code.m and Guide to use MCP2210 TxferSpiData function( page no 16) *
out = gcnew array<unsigned char>(2) {0x00,0x00};
in = gcnew array<unsigned char>(2) {0x00, 0x00};
intret = UsbSpi->Functions->TxferSpiData(out, in);
how to create a unsigned char array (similar to c++ code above in matlab) to receive this data into matlab with TxferSpiData function in dll. Guide page no:16
Thanks & Regards
Ikram khan.S.I
Antworten (1)
Walter Roberson
am 29 Mär. 2013
0 Stimmen
Receive unsigned char as uint8(), and then if necessary char() it to convert to characters.
2 Kommentare
ikram khan
am 30 Mär. 2013
Bearbeitet: ikram khan
am 30 Mär. 2013
Walter Roberson
am 30 Mär. 2013
buffer = uint8(28,1);
success = TxferSpiData(buffer);
if success == 0
spi_chars = char(buffer(1:27));
else
fprintf('TxferSpiData returned error: %d\n', success);
end
Kategorien
Mehr zu Simulink finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!