GPIO_Read and Matlab .NET interface
Posted: Thu Mar 03, 2011 1:33 am
Hello,
I am attempting to use the .NET interface in Matlab to read the GPIO pins. I have been successful in using the GPIO_SetConfig and GPIO_Write (confirmed by reading the settings with the SUB-20 tool); however, when I call the GPIO_Read function the variable I pass it does not appear to update when I toggle the GPIO line(s).
My first attempt was:
GPIOin = 0;
if ~sub20.GPIO_Read(GPIOin)
sub20_close_handle_error(sub20);
end
Matlab did not complain using this data type despite it nativity being a double in Matlab and the SUB-20 .NET component manual calls for a ByRef Int Value, but the variable did not change from 0 despite pulling the configured GPIO input line high.
Second attempt:
GPIOin = System.UInt32;
if ~sub20.GPIO_Read(GPIOin)
sub20_close_handle_error(sub20);
end
This caused Matlab to generate the following error: "No method 'GPIO_Read' with matching signature found for class 'Xdimax.Sub20'."
What is the correct way to use GPIO_Read from Matlab?
Thanks very much,
- Mark
I am attempting to use the .NET interface in Matlab to read the GPIO pins. I have been successful in using the GPIO_SetConfig and GPIO_Write (confirmed by reading the settings with the SUB-20 tool); however, when I call the GPIO_Read function the variable I pass it does not appear to update when I toggle the GPIO line(s).
My first attempt was:
GPIOin = 0;
if ~sub20.GPIO_Read(GPIOin)
sub20_close_handle_error(sub20);
end
Matlab did not complain using this data type despite it nativity being a double in Matlab and the SUB-20 .NET component manual calls for a ByRef Int Value, but the variable did not change from 0 despite pulling the configured GPIO input line high.
Second attempt:
GPIOin = System.UInt32;
if ~sub20.GPIO_Read(GPIOin)
sub20_close_handle_error(sub20);
end
This caused Matlab to generate the following error: "No method 'GPIO_Read' with matching signature found for class 'Xdimax.Sub20'."
What is the correct way to use GPIO_Read from Matlab?
Thanks very much,
- Mark