I'm currently having a hard time sending a bmp image from MATLAB to the LCr. I can load the internal patterns without a problem, but I haven't had success in sending a custom image, yet. Any hints are welcome!
This is my code:
tcpObject = tcpip('192.168.1.100',21845)
fwrite(tcpObject,uint8(hex2dec(['02';'01';'01';'00';'01';'00';'00';'05'])));%switch display mode to static
%create simple image
im = zeros( 30,30);
im (3:8, 3:8) = 1;
imwrite( im, 'im.bmp' );
imFile = fopen( 'im.bmp' );
imData = fread( imFile, inf, 'uchar' );
fclose( imFile );
lenData = length( imData );
lenDataMSB = floor( lenData / 256 )
lenDataLSB = mod( lenData, 256 )
header = uint8(hex2dec(['02';'01';'05';'00'; dec2hex( lenDataLSB, 2 ); dec2hex( lenDataMSB, 2 )]));%static image
data = uint8(imData);
%limit packet size
MAX_SIZE = 512;
buffer = data;
if( length(buffer) > MAX_SIZE )
currentPacket = buffer( 1 : MAX_SIZE);
buffer = buffer( MAX_SIZE + 1 : end );
currentPacket = buffer( 1 : end);
buffer = NaN;
disp('wrote some data')
checksum = mod( sum(header) + sum(data), 256 );
fclose( tcpObject );
I have received your question and will provide you an answer by thursday.
Welcome to DLP&MEMS fourm.
For the display a static image. It is important to note the resolution info of the image. It should be always be 608 x 684 size.
Change your code as following - it should work.
im = zeros( 684, 608);
thanks for your feedback. I managed to send a bmp image to the LCr now!
I created a matlab framework for communicating with the LCr and uploaded it to GitHub.com, for the case anyone else is interested:
Good to know.
You may want to create another thread with the topic something like "MATLAB code to control LightCrafter(TM)" and provide the linke.
We encourage forum users to continue providing utilities which will help others.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.