I am receiving CAN and Ethernet messages I would like to compare them according to timestamp.
i am using socket CAN and "ioctl(s, SIOCGSTAMP, &tv);" function to get timestamp for can frames and it works great;where s is the socket of can
but when i use it for ethernet frames it gives a negative value sometimes but more importantly each timestamp is the same ,what might be wrong?
Related
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.
Im using matlab TCP connection to read the values of a stream data come from external device, the problem is when I used data=fscanf(t , "%d") where t is a TCP object, it reads a different number of values at each time, but I don't want it to do this, I want to read a 46 values at the same time.
Anyone have an idea?
To receive fixed size chunks of 46 values, use the size parameter of fscanf to receive not more than 46 values. Now this receiving has to be triggered only if enough data is available. Best practice is to use the BytesAvailableFcn. If configured with the correct size, it is triggered every time 46 values are available.
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.
I have an IP camera that is located in a different country (with a different time zone) and that has it's own date-time values applied, (for example:~2012-04-16 11:30:00) then the one my PC is located at. (so my PC's time for example is ~2012-14-16 06:10:00)
My purpose:
When streaming, i need to get this date-time value that is set in camera ("11:30:00")
(I'm not interested in a current local time of my PC).
Is there any way to calculate camera's date-time value from RTP's timestamp?
Is there any other approach?
I'm using a Live555 library, and for frame's date-time retrieval I was using a "presentation time" value, but this gives me a local time of my PC (not the time that is set in my camera)
So I'm stuck here..
Read the RFC on RTP packet layout
Note that the Timestamp is in the RTP packet at 0x32. This is the timestamp from the camera that encoded the stream.
For a CPP implementation, processing RTP packet and headers including the timestamp , see the link.
Java implementation of RTP packet handler here
When listening for MidiEvents in NAudio from a MidiDevice, we get the long "AbsoluteTime" property on each event. But what unit is this time in and from what starting point is it measured?
In a MIDI file, each event has a delta in "ticks" since the last event. To make MIDI files easier to work with, NAudio keeps a running total, storing the value in AbsoluteTime. The meaning of this depends on delta ticks per quarter note (which is a property on the MidiFile class), and the tempo (MIDI files ought to include at least one TempoEvent).
When listening for MIDI events from a device, the AbsoluteTime of the MIDI Event created will be 0. However, you can use the TimeStamp property of the MidiInMessageEventArgs which I believe is in milliseconds since MidiInStart was called.