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 that it is a really simple procedure. My problem is that I do not know if I am doing this correctly, or if the device is not processing the signal. My code is:

mysignal = serial('com1'); fopen(mysignal); fwrite(mysignal,1); 
+4
source share
1 answer

I do not think that you can output TTL using the actual serial port, since these are RS-232 and not TTL logic levels. If you use a serial port, you will need a converter, for example. If you are using the FTDI driver / USB cable, which already outputs TTL logic levels, and the code looks good to me, which means that the error is probably at the end of the device.

+11
source

Source: https://habr.com/ru/post/1491106/


All Articles