ADC0808 and propeller
Scott Lewis
Posts: 18
I didn't find any programs for this chip, so I wrote my own. I am new to writing programs for propeller, so I probably did a bunch of stuff not the best way [noparse];)[/noparse].
A little about the program, it uses it's own cog to take conversions constantly. I got about a 9 kHz sample rate in the lab, which is close to the 10 kHz from the datasheet.
I would appreciate feedback about improving my program to make it faster and more efficient. I know I could have used a loop but I needed to do special stuff for input 0, and I had trouble getting it to work with a loop, grr I hate programming, I'm EE not CPE [noparse]:([/noparse]. Here is the program and the datasheet for the 0808
A little about the program, it uses it's own cog to take conversions constantly. I got about a 9 kHz sample rate in the lab, which is close to the 10 kHz from the datasheet.
I would appreciate feedback about improving my program to make it faster and more efficient. I know I could have used a loop but I needed to do special stuff for input 0, and I had trouble getting it to work with a loop, grr I hate programming, I'm EE not CPE [noparse]:([/noparse]. Here is the program and the datasheet for the 0808
pdf
397K
Comments
Recently I learned that routine passing sucks up stack space, and in a stack limited program, passing 8 variables plus the routine jump for 3, could be hard on it.
My suggestions feel free to ignore.
Although it probably would be better to just have it get and return that data for that selected channel, so it can be read as needed, and doesnt suck up a cog.
THE FOLLOWING NEEDS TOUCH UP. Just a suggestions for a code process, the downside of this is we reset the counters every time, taking up conversion time....
Also maybe an example connection diagram to the prop for the default connections.
I don't have the chip in hand, so you'll have to check and debug these, I just reordered you code, and hope it works correctly [noparse]:)[/noparse].
TJ
Post Edited (TJHJ) : 12/11/2008 5:31:18 AM GMT
In Yours diagram I can't see resistors betwen ADC and Prop.
You must have resistors to protect Props I/O pins
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stupid question there is at least one intelligent answer.
Don't guess - ask instead.
If you don't ask you won't know.
If your gonna construct something, make it·as simple as·possible yet as versatile as posible.
Sapieha
Why do I need resistors to protect the I/O pins? It is all CMOS circuitry and no current flows.
TJ
-Mike