Jump to content
Sign in to follow this  
VisSim Forum Archives

Monitor Buffer problem

Recommended Posts

Submitted by ThomasV on Tue, 07/28/2015 - 19:12 

 

I want to use the Monitor Buffer blocks to gather encoder data (position output of eQEP block when I'm controlling a motor) and write this to a file. Then I will analyze the results in Matlab, so I want no data to be missing.

How can I set up the Monitor Buffer blocks in order to do this? I have tried to start from scratch and just try to write the data of a simulated ramp signal, but the buffer is updated way too slowly. I have attached the diagrams (MonitorBufferTest.vsm) I used. The input to the Buffer Write 0 block is a ramp that goes from 0 to 25 in 25 seconds, the sampling rate is 10 kHz and the buffer size is 1000. As trigger I feed a pulse train with frequency of 10 Hz. The way I see it, this should result in the buffer being rewritten 10 times per second, and there should be 10000 samples in 1 second of data gathering.

Now, when I try to run this in the debug diagram, the buffer is being read at a much lower frequency (I compare that frequency to the pulse train of 10 Hz in the plot on the right side, picture 'BufferTrig.png' is attached).

I assume this means that the MCU doesn't write data to the buffer at 10 kHz, so it takes a longer time to fill the 1000 samples in the buffer. What is the cause of this? Should I configure these blocks in a different way?

Note that my starting point was the 'MonitorBufferTriggerAndTimeCheck.vsm' provided by VisSim, but even then I couldn't get the buffers to work correctly.

Also, if there is a better method for gathering measurement data and writing this to a file without losing some parts, I'd be glad to hear it.

MonitorBufferTriggerAndTimeCheck.vsm

MonitorBufferTest-d.vsm

MonitorBufferTest.vsm

BufferTrig.PNG

Share this post


Link to post
Share on other sites

Submitted by pete on Sat, 08/01/2015 - 04:19.

The problem is the buffer is not rewritten until the PC reads it completely. The buffer must traverse the 200Hz JTAG link, so there will be some delay between buffer writes as you are writing to the buffer at 15 kHz. If you don't need the full 15 kHz sample rate, you can put the monitor buffer write inside a compound clocked at 500 Hz or so and get 30x more time covered per buffer. Pete

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...