Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Preparing Data Structure for Data Capture

Preparing Data Structure for Data Capture

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
16 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chaitanya22
    wrote on last edited by
    #1

    How to prepare data structure for capturing data from a machine?? Chaitanya

    D 1 Reply Last reply
    0
    • C chaitanya22

      How to prepare data structure for capturing data from a machine?? Chaitanya

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Can you be a bit more specific? Your question could be answered in a dozen different ways.


      "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

      C 1 Reply Last reply
      0
      • D David Crow

        Can you be a bit more specific? Your question could be answered in a dozen different ways.


        "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

        C Offline
        C Offline
        chaitanya22
        wrote on last edited by
        #3

        I would like to store the data from the sensor after intializing or sending all the commands to the sensor i,e for continous data output??

        D 1 Reply Last reply
        0
        • C chaitanya22

          I would like to store the data from the sensor after intializing or sending all the commands to the sensor i,e for continous data output??

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Does this "sensor" have an API? How is it connected to the computer?


          "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

          C 1 Reply Last reply
          0
          • D David Crow

            Does this "sensor" have an API? How is it connected to the computer?


            "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

            C Offline
            C Offline
            chaitanya22
            wrote on last edited by
            #5

            Via Serial port(rs232)

            D 1 Reply Last reply
            0
            • C chaitanya22

              Via Serial port(rs232)

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              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

              C 1 Reply Last reply
              0
              • D David Crow

                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

                C Offline
                C Offline
                chaitanya22
                wrote on last edited by
                #7

                How to record/process data sent from the sensor????

                D 1 Reply Last reply
                0
                • C chaitanya22

                  How to record/process data sent from the sensor????

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  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

                  C 1 Reply Last reply
                  0
                  • D David Crow

                    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

                    C Offline
                    C Offline
                    chaitanya22
                    wrote on last edited by
                    #9

                    am using Send() and Recieve() functions lnewlength = send(lnewSocket,(char*)lnewData,lDataLenght,0); lnewlength= recv(lnewSocket,(char*)lData,1024,0);

                    D C 2 Replies Last reply
                    0
                    • C chaitanya22

                      am using Send() and Recieve() functions lnewlength = send(lnewSocket,(char*)lnewData,lDataLenght,0); lnewlength= recv(lnewSocket,(char*)lData,1024,0);

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      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

                      C 1 Reply Last reply
                      0
                      • D David Crow

                        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

                        C Offline
                        C Offline
                        chaitanya22
                        wrote on last edited by
                        #11

                        they are for sockets....

                        D 1 Reply Last reply
                        0
                        • C chaitanya22

                          they are for sockets....

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          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

                          1 Reply Last reply
                          0
                          • C chaitanya22

                            am using Send() and Recieve() functions lnewlength = send(lnewSocket,(char*)lnewData,lDataLenght,0); lnewlength= recv(lnewSocket,(char*)lData,1024,0);

                            C Offline
                            C Offline
                            chaitanya22
                            wrote on last edited by
                            #13

                            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???

                            D 1 Reply Last reply
                            0
                            • C chaitanya22

                              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???

                              D Offline
                              D Offline
                              David Crow
                              wrote on last edited by
                              #14

                              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

                              C 1 Reply Last reply
                              0
                              • D David Crow

                                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

                                C Offline
                                C Offline
                                chaitanya22
                                wrote on last edited by
                                #15

                                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

                                D 1 Reply Last reply
                                0
                                • C chaitanya22

                                  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

                                  D Offline
                                  D Offline
                                  David Crow
                                  wrote on last edited by
                                  #16

                                  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

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups