title: Using MATLAB to send multiple serial signals through the same port
body: <p>I'd like to send multiple signals (4 inputs and outputs and 7 outputs) from my Laptop to a microcontroller. I'm thinking of using a USB to serial converter and multiplexing the data through the port. I'll need to write codes both in the laptop end and in the microcontroller to multiplex the data.</p>
  
  <p>Eg: 
  Tx of microcontroller:
  1.Temperature sensor ADC output->Laptop
  2.Voltage sensor to laptop
  3.Current Sensor to Laptop
  4.Photodiode current to Laptop</p>
  
  <p>So I need to write a program in the microcontroller to send the data in this order. How can I accomplish this? <strong>I was thinking of an infinite loop which sends the data with time delays in between.</strong></p>
  
  <p>At the Rx pin of Microcontroller,</p>
  
  <p>Seven bit sequences. Each bit sequence will be used to set the duty cycle of a PWM generated by the microcontroller.</p>
  
  <p>I also need the same multiplexing or demultiplexing arrangement in the matlab end. Here too, I'm thinking of allotting some virtual 'channels' at different instants of time. <strong>What kind of algorithm would I need?</strong></p>