serial commands on Win 32 vs Win 64

I wrote a short block of code to read data from a serial device on a 32-bit Windows 7 machine. It works fine on that machine, but when I tried to use the exact same code on a 64-bit Win7 machine, it doesn't work. I have the same version of MATLAB (2011a), the same device drivers, and the same code, shown below. I can establish the connection to the device and open it (indicated by an led on the sensor), so that isn't the problem. Any ideas?
s = serial('COM1');
fopen(s);
fwrite(s,cmd,'uint8');
out = fread(s,2);
fclose(s);

답변 (1개)

Walter Roberson
Walter Roberson 2011년 7월 27일

0 개 추천

32 bit DLLs do not work with the 64 bit version, so if you have "the same device drivers" you may need to change the one for 64 bit.
You say that it doesn't work, but you have not indicated the problem you see?

댓글 수: 1

Jamie
Jamie 2011년 7월 27일
I'll talk to the vendor tomorrow to see if there are other drivers available. I'm not sure what's going on; when I send the fread command, it just hangs. I don't know if the problem is with fwrite() or fread(), but it works fine on the other system, so I'm even more confused!
I forgot to say, cmd is a uint8 array which is the "read data" command
cmd = [62 2 0]

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

질문:

2011년 7월 26일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by