Mcp3202
John Abshier
Posts: 1,116
Ken Gracey posted an object http://obex.parallax.com/objects/515/ for the MCP3202. His demo program works, but only because he used P0 as the clock pin. It also appears to me that the assembly part of the driver is expecting 5 parameters and the Spin part only sets up 4. Attached is my modification to Chip Gracey's driver with three demo programs. I used the Propeller Professional Development board's pots for input to the MCP3202 and its LEDs to test the DAC part of the driver.
I ask that someone please test/review the attached object. If there is positive feedback, I will ask Ken to replace the object in the OBEX with this one.
John Abshier
I ask that someone please test/review the attached object. If there is positive feedback, I will ask Ken to replace the object in the OBEX with this one.
John Abshier
zip
7K
Comments
I think that's my only object on OBEX and at least I'm glad to have it be a point of discussion and improvement.
As for not being able to use P0 for the DAC output(s), you could either use a negative value or anything greater 31 (instead of 0) to indicate unused (similar to like it's been done originally by setting bits 7/15 meaning valid). Removing functionality (i.e. being able to use pin 0) doesn't seem like a good idea. That said, passing 32 would be recognised as 0 ATM but that's just ugly.
John Abshier
John Abshier
wrlong par,t1 'acknowledge parameter
It appears that as a source par contains an address in hub memory, but as a destination par contains 0.
John Abshier
John Abshier
This thread highlights the need for an open repository where others can contribute to an object's development.
</hijack>
Anyway, usually you'll find stuff like this Use what works for you.
I'm right in the middle of learning how to program... and just about have figured out how to get output from the Parallax joy stick to do something useful, such as turn LEDs on at the moment. Let's hope I can figure out how to pass the CH0 X, and CH1 Y values into variables in my new spin object by tomorrow, mabye.
Way to go, BrainStrain. Feel free to ask around if you feel like you need help.
And welcome to the forums, too!
Ken Gracey
Thanks for reworking the MCP3202 code, I wondered why I could only use P0..P2.
Added this little schematic to the demos...
I think they are correct, not the most profesional, but they do the trick.
Now I will try to use more of the LEDs on the PPDB, or do some kind of cool display with the 16 segment displays.
Anyways, thanks again for fixing the code.
-Tommy