Preparing Data Structure for Data Capture
-
So just search CP articles for "serial." http://www.codeproject.com/system/serial.asp[^] http://www.codeproject.com/system/chaiyasit_t.asp[^] http://www.codeproject.com/internet/serialporttocommunicate.asp[^] http://www.codeproject.com/system/simpleserialcomm.asp[^] http://www.codeproject.com/system/cserialcom.asp[^] You can also Google for the same.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
How to record/process data sent from the sensor????
-
How to record/process data sent from the sensor????
Having not coded very much serial stuff before, this is just a guess. Those other articles I referenced would have shown this, but I think you'll use something like:
HANDLE hPort = CreateFile("\\\\.\\COM1", ..., OPEN_EXISTING, ...);
ReadFile(hPort, ...);Also see here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
Having not coded very much serial stuff before, this is just a guess. Those other articles I referenced would have shown this, but I think you'll use something like:
HANDLE hPort = CreateFile("\\\\.\\COM1", ..., OPEN_EXISTING, ...);
ReadFile(hPort, ...);Also see here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
am using Send() and Recieve() functions lnewlength = send(lnewSocket,(char*)lnewData,lDataLenght,0); lnewlength= recv(lnewSocket,(char*)lData,1024,0);
-
am using Send() and Recieve() functions lnewlength = send(lnewSocket,(char*)lnewData,lDataLenght,0); lnewlength= recv(lnewSocket,(char*)lData,1024,0);
Can those be used with serial communications, or are they for sockets only?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
Can those be used with serial communications, or are they for sockets only?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
they are for sockets....
-
they are for sockets....
Then why are you using them with a serial port?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
am using Send() and Recieve() functions lnewlength = send(lnewSocket,(char*)lnewData,lDataLenght,0); lnewlength= recv(lnewSocket,(char*)lData,1024,0);
Actually, if i would like to store the data of the "lData" parameter when lnewData[]={.....}(soem bytes) in storearray[], the how could i do? Is this correct?? if(lnewdata[8]==({..,..,..,..,..}) { BYTE storearray[1024]= lData; } can i work so with a string???
-
Actually, if i would like to store the data of the "lData" parameter when lnewData[]={.....}(soem bytes) in storearray[], the how could i do? Is this correct?? if(lnewdata[8]==({..,..,..,..,..}) { BYTE storearray[1024]= lData; } can i work so with a string???
chaitanya22 wrote:
Is this correct??
I doubt it.
chaitanya22 wrote:
if(lnewdata[8]==({..,..,..,..,..})
What is
lnewdata
? Are you comparing or (supposed to be) assigning?chaitanya22 wrote:
BYTE storearray[1024]= lData;
What is
lData
?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
chaitanya22 wrote:
Is this correct??
I doubt it.
chaitanya22 wrote:
if(lnewdata[8]==({..,..,..,..,..})
What is
lnewdata
? Are you comparing or (supposed to be) assigning?chaitanya22 wrote:
BYTE storearray[1024]= lData;
What is
lData
?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
BYTE lnewData[8]={0x02, 0x00, 0x02, 0x00, 0x20, 0x24, 0x34,0x08} lnewlength= recv(lnewSocket,(char*)lData,1024,0); if(lnewData[8]=={0x02, 0x00, 0x02, 0x00, 0x20, 0x24, 0x34,0x08}) { BYTE storearray[1024]=lData; //i would like to store the array of recieved bytes in storearray[1024] } chaitu
-
BYTE lnewData[8]={0x02, 0x00, 0x02, 0x00, 0x20, 0x24, 0x34,0x08} lnewlength= recv(lnewSocket,(char*)lData,1024,0); if(lnewData[8]=={0x02, 0x00, 0x02, 0x00, 0x20, 0x24, 0x34,0x08}) { BYTE storearray[1024]=lData; //i would like to store the array of recieved bytes in storearray[1024] } chaitu
chaitanya22 wrote:
if(lnewData[8]=={0x02, 0x00, 0x02, 0x00, 0x20, 0x24, 0x34,0x08})
What is this? Try:
BYTE compare[8] = {0x02, 0x00, 0x02, 0x00, 0x20, 0x24, 0x34,0x08};
if (memcmp(lnewData, compare, 8 * sizeof(BYTE)) == 0)
{
memcpy(storearray, lnewData, 8 * sizeof(BYTE));
}
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb