Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send TTL signal through serial port in Matlab

I am trying to send a TTL signal through a serial port using Matlab. I just need to send 1 value to the device so it should be a really simple procedure. My problem is that I don't know if I am not doing this correctly or if the device is not processing the signal. My code is this:

mysignal = serial('com1');
fopen(mysignal);
fwrite(mysignal,1);
like image 874
PL-RL Avatar asked Dec 21 '22 03:12

PL-RL


1 Answers

I don't think you can output TTL using the actual serial port, as that is RS-232, not TTL logic levels. If you're using the serial port, you'll need a converter, like this. If you're using an FTDI driver/USB cable, that already outputs TTL logic levels, and the code looks good to me, which means the bug is probably on the device end.

like image 116
achase90 Avatar answered Jan 02 '23 00:01

achase90