Usage of serial receive block of simulink to read from COM port of PC giving erroneous value any solution? - simulink

I was trying to use serial receive block of simulink to read data from COM port. The data is received from an mbed board to COM port and from COM port I want to read it using simulink. When I read it, Im getting some values not related to what I send. Some values like 1.38*e^-38 is showing as output of serial receive block when i try to read '10'. Is this any conversion issue?
I have given baud rates correctly in both ends.

Related

how to make event marker for Emotiv EPOC (portable EEG)?

I am thinking to measure ERP from Emotiv EPOC (EEG), but in analysis, data should be divided based on timing of onset and offset of stimulus. So, during recording, timing of event, such as onset or offset, needs to be marked. Emotiv PRO offers function to record event marker via serial port. However, I have little knowledge about serial port, and I couldn't marked event.
Could you tell me basic usage for Emotiv PRO about event marker via serial port ?
Below is what I tried.
First, I tried from MATLAB (2018a),
s=serial("/dev/cu.Bluetooth-Incoming-Port");
fopen(s);
then, from Emotiv PRO, I started "set up serial point markers" but response was
Resource Busy.
Second, I tried in different order and from Emotiv PRO, started "set up serial point markers", and then from MATLAB, ran same code, but response from MATLAB was
Cannot connect to the /dev/cu.Bluetooth-Incoming-Port port. Possible reasons are
another
application is connected to the port or the port does not exist.
Third, I tried new MATLAB (2020a),
s=serialport("/dev/cu.Bluetooth-Incoming-Port",9600)
and I started "set up serial point markers" from Emotiv PRO (error didn't appeared),
and, again from MATLAB (2020a)
write(s,1,"uint8")
but, marker didn't appeared in Emotiv PRO.
I confirmed that Emotiv PRO appropriately record marker from key pressing, but I couldn't from serial port.
Oy, this isn't easy. Assuming you have no actual serial port, you need some sort of virtual port. One option is to use a software to create it. then your matlab will send a message to its port and Emptiv will receive the message with another port, both virtual. You will need to make sure the format is set the same way for both sender and receiver, such as BAUD = 115200 bps, Data size = 8 bits etc. Alternatively you can use a null modem cable, to connect a USB wire and convince both sender and receiver that these are two sides of a serial cable. I used it successfully using two computers, one to send the signal and one to receive.

Not ACK bit in the AT24C512C EEPROM Read operation via I2C connection

As you can see in the below picture of the AT24C512C datasheets from ATMEL,after reading desired data from EEPROM,there is a NOT ACK bit following the data which I don't understand is produced by the EEPROM or MCU(master)?
As you know past ACK bits in the writing data to EEPROM was produced by EEPROM to acknowledging a correct data receiving.Reading section
NOT ACK bit is produced by MCU (master) to generate stop condition here and if there is any error while slave receiving the data then it would be hardware generated by the slave or you can say EEPROM. It is a two-way communication.
If you are using this module I will suggest you to use random read by providing the address on ehich data is written and you read the same address. Then , it would work. It would be similar to codes in the following link. You can choose the language as per the mcu you are using.
https://github.com/ControlEverythingCommunity/AT24HC02C

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);
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.

Difference between "Serial Send" and "To Instrument" blocks

The Instrument Control Toolbox in MATLAB/Simulink contains two blocks that can send data to a device on a serial port:
Serial Send: Send binary data over serial port
To Instrument: Send simulation data to instrument
It looks like the To Instrument block is more general-purpose than Serial Send. To Instrument allows you to select the underlying interface, with one option being "Serial".
What is the difference between To Instrument (when configured with Interface=Serial) and Serial Send? Is there any reason to prefer either one for sending, say, 4 bytes of numeric data to the device? Are there any other situations where only one of them would work?
One difference:
The "To Instrument" and "Query Instrument" blocks are older blocks and were hardcoded to only be used for ports COM1-COM4. For a device that's on a different serial port, please try the "Serial Send" and "Serial Receive" blocks to achieve the same functionality. The block parameters dialog for these blocks should auto-populate the list of available COM ports to communicate with so that you can select the proper port for your device.

What is the difference between UART port and serial port in a computer?

What is the difference, if any, between a UART port and a serial port in a computer?
UART is the abbreviation of Universal Asynchronous Receiver Transmitter, the name of the chip that enables the computer to communicate via a serial line (eg. RS-232, RS-485, RS-422).
The serial port is the RS-232 interface (internally connected to the UART) of the computer.
As #SurDin explained some more points I want to add
1.UART takes data parallel and the help of shift register transfer it bit by bit or takes data bit by bit and reform those into parallel form via communication channel like RS-232,RS-485,RS-422.
2.UART has a baud rate generator, transmeter and a receiver.
3.Its baud rate generator gets clocked either by internal clock or by external source.
communication media linked to serial port which internally connected to UART controller.