Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   read serially (http://www.go4expert.com/forums/read-serially-t21195/)

answerme 4Mar2010 12:25

read serially
 
Hi all
I want to read number of bytes serially ,but i am getting an error that is

Code:

error C2664: 'CSerialCom::ReadByte' : cannot convert parameter 1 from 'DWORD [10]' to 'DWORD &'
where buffr is
DWORD buffr[10];
& iam reading buffr serially below here.

if((port.ReadByte(buffr)))


Iam able to write perfectly but reading iam facing problem

Gene Poole 9Mar2010 19:04

Re: read serially
 
You'll need to post more than just that. There's no way to diagnose your error without knowing more about the problem.

answerme 19Mar2010 12:35

Re: read serially
 
well actually I am sending(i.e. writing) CSTRING data through serial port. & reading it through Dword since CSerialcom readbyte has only one parameter i.e DWORD.
Well I am able to send(write) the full data 57 char (checked in hyper terminal also).
But when I am reading data I am getting only 46 char.. I don't know why. I tried to convert DWORD to CString but i couldnt get suceed

Code:

Sending /Writing Data Serially
CString data="dfdfsdfwewrrttnmnmbn12.343iuyiuyiuyiuyiyuyubnmb nbvbnbn"

Receiving Serially
CSerialcom port;
DWORD buffer;
unsigned char frame;
int i;
if(port.ReadByte(buffer))>0)
frame[i++]=(unsigned char)buffer;
In buffer i am receiving only 46 char


Gene Poole 19Mar2010 20:37

Re: read serially
 
1. What is CSerialcom? Not a standard class.

2. "frame" is a single byte. How did you even get "frame[i++]=..." to compile?

3. if you got this to compile, it probably ran the buffer over some critical part of your code at 46 bytes. Did it crash? Did you try to debug?


All times are GMT +5.5. The time now is 10:31.