Shop OBEX P1 Docs P2 Docs Learn Events
PASM ADC object for review — Parallax Forums

PASM ADC object for review

PhilldapillPhilldapill Posts: 1,283
edited 2009-04-17 19:04 in Propeller 1
First off, please excuse my coding. This is my first PASM program I've written.

The attached program (ADS7816.spin), is a driver for TI's ADS7816, 12-bit single channel ADC chip. The chip is capable of 200ksps, and I think the Propeller can definitely handle it. In fact, when you look at the code, you'll notice MANY "nop" commands. This is because the Propeller is faster than the ADC can handle, so I had to slow the Propeller down a bit. I have the object working just fine, but I'd like to optimize it some more. Here is what I had in mind.

I believe the sampling rate is just about maxed out, so I'd like to add some averaging of samples to the code. There are tons of "nop's", so I figured I could replace these with tid-bits of commands here and there. In between commands, I would keep a running average buffer. By this, I mean have allocated registers to store about 32 samples, and replace the oldest sample with the newest sample during each sample period. In addition to this running buffer, I'd like to be able to take averages of the last 8, 16, and all 32 samples. At the end of the sampling period, and once I have these averages, I want to write each average to hub memory for external use.

I'm just learning PASM, so I'm asking how to do this. I understand basic commands, but I have yet to understand pointers(and a number of other things). Any and all help is greatly appreciated.
Sign In or Register to comment.