I have a pin which is being toggled every 100ms by an MCU. I need to plot a graph which consists of the variation from the desired interval . That is the number of times it moved away and was toggled for 101ms or 98 ms and so on. I tried to do it with a scope but the memory seems to be limited. I can capture a maximum of 50000 lines as csv . Even if I reduce the sampling rate , it is nowhere close to the 4 hours of data I need to capture. What kind of an instrument should I be looking for? Is there any easy way to achieve this?
Streaming data constantly to a computer rather than using one long acquisition will most likely be easier to implement and makes use of a computers large available storage. Because you only need digital data a usb logic analyzer is probably the cheapest and easiest option.
Couple of options come to mind:
Depending on your oscilloscope you should be able to stream data to a pc to analyze quickly enough so that your 50000 sample buffer never fills up. I would contact your scope manufacturer and read through the manual to see if this is possible and if so the best way to implement it.
Use a data acquisition card from national instruments or some other company to continually acquire and analyze data. The benefit here is that you can use a program such as Labview to make set up and testing a bit easier if you don't have much programming experience. Make use of the digital logic pins, no need to use analog acquisition.
Use a usb logic analyzer. Cheap. Easy to implement. There might even be one out there that comes with software which can do the analysis you need out of the box.
You're describing a histogram of the pulse widths. Both the timing and the counting would be well within the capabilities of a modest micro-controller, either a ready-built experimenters board, or build it on a bread-board. Taking an interrupt at 10 Hz would barely use the capabilities of a $5 chip. In 4 hours, a 10Hz pulse train would fire 144000 times and if it's a rock-solid 10Hz, your histo will count only one bin which would need to be able to accumulate that big a number. That's bigger than a 16-bit int (you'd need 18 bits) but easily handled by using long ints (32 bits). Figure the timing resolution (bin size) and maximum departure 1.0ms you need to quatify and decide how many bins you need. You'll need 4x that number of bytes to hold the histo. Assuming you need ~20 bins, you're still well within the resources of a modest micro-controller.
It isn't an off-the-shelf solution if that's what you need, but it will be way less money than buying a bench instrument. Lots more fun, too! (Unless you need the data yesterday...)
I'm assuming you have a computer with a USB port at your disposal for programming the chip, as well as for collecting the data.
You'd arrange for the signal to interrupt the MCU whenever it changes. You'd keep one of the timers running continuously a timer at 1KHz (for 1ms resolution). On every rising edge, your ISR would read and save the timer. On every falling edge, it would read the timer again and subtract the saved value from it to get the pulse width. Assign that value to one of your histogram counters and increment the counter.
will histograph the actual pulse widths in msec (as opposed to the deviation from 100 ms]. Plotting a histo of deviation only requires relabeling the t-axis.
Obviously, pick the timer resolution & bin sizes that make sense for your application. I chose 1ms buckets from 0ms to [as many as you need], representing -100ms to +?? of deviation.