Results 1 to 3 of 3

Thread: Sniffing Serial Port Causing Odd Results

  1. #1
    Join Date
    Nov 2018
    Posts
    2
    Post Thanks / Like

    Default Sniffing Serial Port Causing Odd Results

    I'm able to echo the data from a 4-channel setup from vixen to a nano board. According to what I understand, vixen reads channel one, then channel two...until channel 4 is read. It will read zero or one depending on if a light is OFF or ON. Sequence.JPG. The image shows that channel one should be ON five times on that first green rectangle and the rest of the channels must be OFF. After sniffing the serial port, the data shows that the first channel is off, but the second channel is on instead. Sequence2.JPG. Can anyone tell me why the code jumps to the next byte? It behaves "most of the time" like this and sometimes it does it works as it suppose to work. Do I need to flush the serial port? Im using Arduino Uno to read off vixen. Could be that arduino UNO is not fast enough to update the serial port?. To clarify this post, please pay attention to the first green rectangle only. Thanks
    Code:
     ...
    
          case DISP://Decodes Data and Translates
            state = IDLE;
    
            for (ch = 0; ch < MAX_CHANNELS; ch++)
            {
              if (chVal[ch] > 0)
              {
                echoSerial.write((char)256- chVal[ch]);
              }
              else
              {
                echoSerial.write((char)chVal[ch]);
              }
            }        
            break;
        }    
      }
    }

    Thanks
    Last edited by hbtousa; 02-23-2021 at 09:43 AM.

  2. #2
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    1,827
    Post Thanks / Like

    Default Re: Sniffing Serial Port Causing Odd Results

    Your first line is confusing but I think you mean that vixen will send the data channels 1-4. Looks like you are using generic serial with a header of +>. Also, Vixen doesn't send a 1 or zero, but sends the value of what you set in your sequence. If you are setting a value, you get that value.

    Code looks okay. I would go immediately to display when it it is triggered but that is just me. If I read your code correctly, you are waiting for the next byte (50ms later?) before displaying the channel data.

    Anyway, are you sure you have channel one and two in the sequencer and not channels 2 and 3?

  3. #3
    Join Date
    Nov 2018
    Posts
    2
    Post Thanks / Like

    Default Re: Sniffing Serial Port Causing Odd Results

    Quote Originally Posted by MikeKrebs View Post
    Anyway, are you sure you have channel one and two in the sequencer and not channels 2 and 3?
    yes, channel one and two are in the sequences. I redid Case Disp and now is working fine. Thanks for your inoput

Tags for this Thread

Bookmarks

Posting Permissions

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