new MCP3XXX ADC driver
Bobb Fwed
Posts: 1,119
I'm just looking for some people who would test my new ADC object. It is a [noparse][[/noparse]robust] driver for the MCP3208 (12-bit) and MCP3008 (10-bit).
It can do the obvious (get current values of channels) but also can be customized as a Schmitt input, max/min values over time, value averaging, and input frequency are all available.
I am hoping some people can download it here: obex.parallax.com/objects/488/
Let me know if everything works as expected, what features should be added.
Any suggestions on how to make the coding faster is always helpful.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Post Edited (Bobb Fwed) : 7/24/2009 6:35:54 PM GMT
It can do the obvious (get current values of channels) but also can be customized as a Schmitt input, max/min values over time, value averaging, and input frequency are all available.
I am hoping some people can download it here: obex.parallax.com/objects/488/
Let me know if everything works as expected, what features should be added.
Any suggestions on how to make the coding faster is always helpful.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Post Edited (Bobb Fwed) : 7/24/2009 6:35:54 PM GMT
Comments
This is great, I have a SpinStudio module based on the MCP3208, I'm currently writing the documentation for now. The upcoming IODreamKit also has a MCP3208 onboard. I was pointing to Chip Gracey's object in the OBEX for customers to use as an example, mind if I point to your object from the documentation as well?
ADC was one area of my product offerings that was lacking. The MCP3208 module and IODreamKit should fill that hole.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Brian
uController.com - home of SpinStudio - the modular Development system for the Propeller
PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!
SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
So, link to it, it still does more than the other and in the future it will be more complete...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
When do you expect to start selling the MCP3208 module and the IODreamKit?
TrapperBob
Added the ability to limit the number of channels scanned. Make make the driver compatible with 1, 2, 4, and 8 channel ADCs.
Added method to get an average of a channel over a specified amount of time. This is in addition to the method that allows for an average over a specified number of samples.
Max/min values are now stored for active channels while in a single-channel-exclusive actions (waits/freq/average). But they are not stored to cog memory until the following time the channel is active (up to 4800 cycles later).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
I hope to have the MCP3208 module ready by this weekend, I have the kits all made up and ready to ship, it's just a matter of documenting the kit.
The IODreamKit will be another month or 2. The design needs some minor tweaking and I need to work on methods of producing them en masse. The prototypes took about 45 minutes to an hour each to assemble. Since the IODreamKit is mostly SMT parts, I will assemble and test each one before shipping. Coming up with a suitable assembly process to get these reliably assembled, while keeping the cost for the product reasonable is a challenge. I hope to make some real progress over the next month.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Brian
uController.com - home of SpinStudio - the modular Development system for the Propeller
PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!
SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
Brian sent me one of the first IODreamkits and it's an absolute beauty! Brian has a gift for making pcb's look and work great.
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Download a free trial of ViewPort- the premier visual debugger for the Propeller
Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
Changes:
Some optimization: Replaced the MUX shift out with a CTR NCO shift out. Rearranged end of loop code to evenly space WRLONGs. This increased the sample frequency from 119ksps to 127ksps.
Fixed a problem introduced in v0.7 with the minimum value output.
Reduced the number of instructions executed during resetmax and resetmin.
Differential and single-ended mode can be enabled during start up with mode setting. Both the mode and active channels values are part of the start method parameters.
The ADC and it's driver cog can be put into standby mode to save power. All values are ignored in this mode. Standby exiting check time is a customizable value.
this will be my last update on the forum for this object (unless continued interest is shown)
I am still hoping for some feedback on functionality of the driver...I hope some people are using it, and no news is good news.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Man, I wish I knew that you were working on code for the MCP3202,04, and 08. We could have collaborated our efforts! - Good Job!
I like your idea on setting the behavior of the input threshold and making it act like a programmable I/O.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Cheers!
Paul Rowntree
I also wrote a driver for the MCP3208. I had it running much faster than the spec, so I talked to the manufacturer. They said it can vary some from chip-to-chip or batch-to-batch. So I ended up slowing it down to match the spec, just to be sure other people wouldn't have problems.
Keep at it, looking good!
Jim
The big difference comes when you switch between normal operational values and a single-channel command (like average or frequency) but the difference (in testing) is less than 1%.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
I can post some of that code if others think it would be useful.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jim Fouch
FOUCH SOFTWARE
Then the PASM would populate it. I think it would be a sub version of the program because it would be more difficult to integrate the object, but more flexible.
It would also make the channel values accessible with less cycles. It would also make it look more like the standard IN[noparse]/noparse
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Additions in 1.1:
Added alternate start method: start_pointed. This allows for multiple objects to access current channel value, state, and max/min. The parent object supplies 4 8-long blocks which are used instead of the object's blocks.
Shifting in and out has been sped up. While fewer instructions are used per bit, it creates a problem. This object should be run at operating clock frequencies of less than 80MHz. At 80MHz, the driver runs at almost 50% faster than the MCP3XXX ADCs are designed to operate. This could produce invalid, or unexpected outputs. 64MHz or less is recommended (though still 25% over spec). At 40MHz, all MCP3XXX ADC should operate fine.
In the future I will add a subversion into the object. When the operating clock frequency is detected to be above 64MHz, it will launch a slower version of the driver (customizably slow though). In all other cases, it will run the [noparse][[/noparse]current] fast version to get as many samples as possible at the slower clock speeds.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Excelling job on the driver. I like the way you comment the code.
Re:but also can be customized as a Schmitt input,
Do you have a reference to this in the driver. I read through most everything (at least twice) and the Microchip Spec PDF but somehow I missed it. Maybe I just need glasses
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
What I did wrong:
I think I figured it out. I only seen a reference to the Schmitt trigger in your post and not in the driver object. The driver version I have printed is 1.1.
Solution:
I just downloaded a new version of the driver and it's now up to 1.31 I see that it has lots of additional info.
Also, there is a Schmitt trigger reference is in another object" ADC Frequency Reader v1.1 " (first time I saw this object)
"****************************************
''* ADC Frequency Reader v1.1 *
''* Author: Brandon Nimon *
''* Created: 6 July, 2009 *
''* Copyright (c) 2009 Parallax, Inc. *
''* See end of file for terms of use. *
''***********************************************************************************
''* This PASM-driven object reads the values off of an MCP3008/3208 analog-to- *
''* digital converter (ADC). It can mimic a Schmitt trigger, only clocking cycles *
''* after the channel's value has gone from a low threshold to a high threshold. *
''* Jitter can be easily reduced by requiring the "high" input to last for a *
''* certain number of ADC read cycles ("samples"). The "high" value can also be *
''* easily changed to fit the needs of the input and to widen the "Schmitt gap".
Ok great. I may not need glasses after all. I'll just print a fresh copy of everything and start from the beginning.
Any requests as to additions in the next version?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!