×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Jul 2011
    Posts
    100

    transforming instruction

    I try to send this sequence that is written in Matlab as follows:
    V = uint8 ([0 0 0 0 0 0 0 0 mod (640.256) floor (640 / 256) 0 0 mod (480.256) floor (480/256) 0 0 1 0 0 0 1 0 0 0]);
    and my way to send the string is as follows:
    char a1=0;
    char a2=0;
    char a3=0;
    char a4=0;
    char b1=0;
    char b2=0;
    char b3=0;
    char b4=0;
    char c=128;
    char d=512;
    char b=0;
    char a=0;
    char e=224;
    char f=256;
    char g1=0;
    char g2=0;
    char g3=1;
    char g4=0;
    char g5=0;
    char h1=0;
    char h2=1;
    char h3=0;
    char h4=0;
    char h5=0;
    QByteArray bytesToSend;
    bytesToSend.push_back(a1);
    bytesToSend.push_back(a2);
    bytesToSend.push_back(a3);
    bytesToSend.push_back(a4);
    bytesToSend.push_back(b1);
    bytesToSend.push_back(b2);
    bytesToSend.push_back(b3);
    bytesToSend.push_back(b4);
    bytesToSend.push_back(y);
    bytesToSend.push_back(d);
    bytesToSend.push_back(b);
    bytesToSend.push_back(a);
    bytesToSend.push_back(e);
    bytesToSend.push_back(f);
    bytesToSend.push_back(g1);
    bytesToSend.push_back(g2);
    bytesToSend.push_back(g3);
    bytesToSend.push_back(g4);
    bytesToSend.push_back(g5);
    bytesToSend.push_back(h1);
    bytesToSend.push_back(h2);
    bytesToSend.push_back(h3);
    bytesToSend.push_back(h4);
    bytesToSend.push_back(h5);
    this->socket->connectToHost(host, port);
    if(socket->waitForConnected(3000)) {
    qDebug("Connected.");
    this->socket->write(bytesToSend);

    if I do not know how I correctamente.no define each of the values ​​for Quesada sent the instruction as in matlab
    thank you very much

  2. #2
    Registered User
    Join Date
    May 2009
    Location
    Greece
    Posts
    191

    Re: transforming instruction

    The problem was in the result of the floor function. Thus, the working code goes like this:
    Code:
    static const char mydata[] = {
         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
         0x80, 0x02, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00,
         0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
     };
    
     QByteArray data = QByteArray::fromRawData(mydata, sizeof(mydata));
     this->socket->connectToHost( host, port);
    
     if(socket->waitForConnected(3000)) {
       qDebug("Connected.");
       this->socket->write(data);
     }

Similar Threads

  1. Replies: 2
    Last Post: 2011-05-19, 09:57
  2. Replies: 3
    Last Post: 2009-10-10, 19:34
  3. ASM Instruction set
    By earamsey in forum Symbian
    Replies: 2
    Last Post: 2007-04-23, 08:02
  4. AT instruction set
    By Nokia_Archived in forum Nokia M2M
    Replies: 1
    Last Post: 2002-05-20, 17:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×