SE USA
Offline
Faraday Member
Karma: 33
Posts: 3625
@ssh0le
|
 |
« Reply #15 on: March 30, 2010, 12:35:40 pm » |
yours says something about memory too, but basic functionality should be close enough
I dunno we will see later when I have time to sit down and look it all over in detail
|
|
|
|
« Last Edit: March 30, 2010, 12:38:51 pm by Osgeld »
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
B0100111001000011, USA
Offline
Edison Member
Karma: 0
Posts: 1503
I'm confused. Wait, maybe not..
|
 |
« Reply #16 on: March 30, 2010, 12:39:25 pm » |
Indeed. With the same manufacturer, I would assume the SPI communication is near identical.
On a side note (that i don't feel like starting a new topic over), does anyone know where I can get some Hydrochloric (Muriatic) Acid?
I'm looking to make some etchant so I can start making my own PCBs, but all of my nearby hardware stores seem to be out of stock. I found about 32 Oz of it on eBay for about 20 bucks, but that's a ripoff considering at Lowes 1 gallon only costs about 7 bucks...
|
|
|
|
|
Logged
|
|
|
|
|
SE USA
Offline
Faraday Member
Karma: 33
Posts: 3625
@ssh0le
|
 |
« Reply #17 on: March 30, 2010, 12:46:59 pm » |
check a pool store
|
|
|
|
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
B0100111001000011, USA
Offline
Edison Member
Karma: 0
Posts: 1503
I'm confused. Wait, maybe not..
|
 |
« Reply #18 on: March 30, 2010, 12:47:39 pm » |
Oooh I never thought of that. I'll have to check if there are any nearby..
Thanks.
|
|
|
|
|
Logged
|
|
|
|
|
Brooklyn, NY
Offline
Newbie
Karma: 0
Posts: 28
|
 |
« Reply #19 on: March 30, 2010, 01:28:19 pm » |
That's a bit overkill for my situation (unless in the future I want to have multiple outputs on the supply), so I found what looks to be a similar version (it's similar and uses SPI like the AD5206). It's the MCP4131. Here's the datasheet:
We're using a microchip pot and it works well with the arduino. My grad student wrote some SPI code that works quite well. Hit me up if you'd like it, we haven't released it publicly just yet (it's part of a large project), but that code is ready to go.
|
|
|
|
|
Logged
|
|
|
|
|
Brooklyn, NY
Offline
Newbie
Karma: 0
Posts: 28
|
 |
« Reply #20 on: March 30, 2010, 01:52:54 pm » |
Here's the code for the Microchip MCP4261 http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en531252. Right now it's in bit banging mode (as in note using native spi, but it's very, very fast). //Barry's hacky functions
byte value;
byte sendBit(boolean state) { digitalWrite(SPICLOCK,LOW); delayMicroseconds(10); digitalWrite(DATAOUT,state); digitalWrite(SPICLOCK,HIGH); delayMicroseconds(10); }
byte sendValue(int wiper, int val) //tested cycle time for this function is ~565 microseconds. { value = byte(val); //digitalWrite(SPICLOCK,LOW); //digitalWrite(DATAOUT,LOW); digitalWrite(SLAVESELECTP,LOW); delayMicroseconds(10);
//Select wiper for(int i=0;i<3;i++){ sendBit(false); } sendBit(wiper);
//write command for(int i=0;i<4;i++){ sendBit(false); } //data sendBit(HIGH && (value & B10000000)); sendBit(HIGH && (value & B01000000)); sendBit(HIGH && (value & B00100000)); sendBit(HIGH && (value & B00010000)); sendBit(HIGH && (value & B00001000)); sendBit(HIGH && (value & B00000100)); sendBit(HIGH && (value & B00000010)); sendBit(HIGH && (value & B00000001)); //sendBit(true); //fudge digitalWrite(SLAVESELECTP,HIGH); //Serial.println(in); delayMicroseconds(10); }
byte readWiper() { //send read command digitalWrite(SLAVESELECTP,LOW); delayMicroseconds(10); sendBit(false); sendBit(false); sendBit(false); sendBit(false); sendBit(true); sendBit(true);
//get data int data[9]; Serial.print(" "); for(int i=0;i<9;i++) { digitalWrite(SPICLOCK,LOW); delayMicroseconds(10); digitalWrite(DATAOUT,LOW); delayMicroseconds(10); data[i] = digitalRead(DATAIN); digitalWrite(SPICLOCK,HIGH); delayMicroseconds(10); Serial.print(data[i]); } digitalWrite(SLAVESELECTP,HIGH); }
|
|
|
|
|
Logged
|
|
|
|
|
Mobile, AL
Offline
Sr. Member
Karma: 0
Posts: 314
CAUTION!-Slow Learner
|
 |
« Reply #21 on: March 30, 2010, 02:01:04 pm » |
TchnclFl: wish you were close - I've got a 1/2 gallon of HCl left I'd be happy to share - been using out of it for a yr for PCB etching. Stuff is cheap at local hardware store. I'd expect shipping to be a bugger due to being acid?
Ken H.
|
|
|
|
|
Logged
|
|
|
|
|
B0100111001000011, USA
Offline
Edison Member
Karma: 0
Posts: 1503
I'm confused. Wait, maybe not..
|
 |
« Reply #22 on: March 30, 2010, 02:02:41 pm » |
Yeah I think you have to get a permit or something to ship it  .
|
|
|
|
|
Logged
|
|
|
|
|
Mobile, AL
Offline
Sr. Member
Karma: 0
Posts: 314
CAUTION!-Slow Learner
|
 |
« Reply #23 on: March 30, 2010, 02:34:30 pm » |
BTW. there was a comment made about one pot having 256 vs other pot having 257 positions - is that not the same number of positions? 8 bit? from 0 to 256 which "is" 257 by counting 0 as the first position.
I will be following this thread hoping to learn some - as I've said, I'm a slow learner! :'(
Ken H.
|
|
|
|
|
Logged
|
|
|
|
|
B0100111001000011, USA
Offline
Edison Member
Karma: 0
Posts: 1503
I'm confused. Wait, maybe not..
|
 |
« Reply #24 on: March 30, 2010, 02:36:16 pm » |
BTW. there was a comment made about one pot having 256 vs other pot having 257 positions - is that not the same number of positions? 8 bit? from 0 to 256 which "is" 257 by counting 0 as the first position.
Yeah sounds like it. But maybe the 256 doesn't have a "0" (no resistance) position. Perhaps it only has a low position (which, if my calculations are correct, would be about 40 Ohms on an 8-bit pot).
|
|
|
|
|
Logged
|
|
|
|
|
Mobile, AL
Offline
Sr. Member
Karma: 0
Posts: 314
CAUTION!-Slow Learner
|
 |
« Reply #25 on: March 30, 2010, 03:04:38 pm » |
I don't "think" the zero indicates a "zero" ohms - is 0 not the first position of binary? as in 0, 1, 2, 4, 8,..... 256? and when those positions are counted, there is actually 257 points.
Same as the discussion on 10 bit ADC in the m168 chip - 1023 or 1024 counts? The count is 0 to 1023 which is 1024 "pieces".
Ken H>
|
|
|
|
|
Logged
|
|
|
|
|
SE USA
Offline
Faraday Member
Karma: 33
Posts: 3625
@ssh0le
|
 |
« Reply #26 on: March 30, 2010, 03:41:15 pm » |
cool thanks, that will definitely save some head scratching tonight!
|
|
|
|
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
Phoenix, Arizona USA
Offline
Faraday Member
Karma: 27
Posts: 5083
Where's the beer?
|
 |
« Reply #27 on: March 30, 2010, 04:07:52 pm » |
Oooh I never thought of that. I'll have to check if there are any nearby.. I was just asking my wife last night if we knew anybody with a non-salt water pool; I was wanting to buy some HCl myself for the same purpose, but I didn't want to store 2 gallons worth (for pools, they typically come in a box with two 1 gallon jugs). I only want about 32 oz. You can typically find the stuff anywhere pool stuff is sold; I know our local Albertsons carries it; Frys (groceries) carries it; Safeway has it too. You might also be able to find it in higher concentrations at a janitorial supply or hardware store as a concrete cleaner/etchant... 
|
|
|
|
|
Logged
|
|
|
|
|
B0100111001000011, USA
Offline
Edison Member
Karma: 0
Posts: 1503
I'm confused. Wait, maybe not..
|
 |
« Reply #28 on: March 30, 2010, 04:32:28 pm » |
I just found out my local Lowes just got it back it stock. I snagged it online and just picked it up.
It's a full gallon, but at least I know I won't need more ;D!
|
|
|
|
|
Logged
|
|
|
|
|
SE USA
Offline
Faraday Member
Karma: 33
Posts: 3625
@ssh0le
|
 |
« Reply #29 on: March 30, 2010, 10:48:11 pm » |
the mcp42xxx family are almost identical, and I have it working on my 42100, it should work the same on a 42x1 (I have not looked at the single pot models much since I do not have one, and the x2 models are slightly different more) the only confusion I have about it is pin 11, on mine its marked reset, and needs to stay high unless you want both pots to goto default 50% wiper pos on your chip is marked (overscore) WP, which skimming that HUGE data sheet many times, never found out what that really means, try leaving it disconnected, and if it does not work ... also the wording on microchips website is odd for your chip, it claims 7 bit 129 position, but in the chart below it declares 257, the data sheet as a whole covers the entire mcp4YxxZ family the following produces a sawtooth wave, and is easily seen with a multimeter using a MCP42100, data output is treated the same way as a 74HC595 (only using 1 channel) pins 1 -CS to DIGITAL PIN 2 (same as latch) 2 -SCK to DIGITAL PIN 3 (clock)3 -DTA to DIGITAL PIN 4 (data)4 & 5 GROUND6 NC (channel 2 wiper)7 +5v8 +5v9 + of multimeter10 GROUND11 on mine +5v, good luck 12 +5v13 NC (daisy chain output)14 +5vscript #define sLatch 2 #define sClock 3 #define sOdata 4 #define commandData B00010001 // command = write to pot 0
byte data;
void setup() { pinMode(sLatch, OUTPUT); pinMode(sClock, OUTPUT); pinMode(sOdata, OUTPUT); Serial.begin(9600); }
void loop() { for(int i = 0; i < 255; i++) { data += byte(1); digitalWrite(sLatch, LOW); shiftOut(sOdata, sClock, MSBFIRST, commandData); shiftOut(sOdata, sClock, MSBFIRST, data); digitalWrite(sLatch, HIGH); Serial.println(data, BIN); delay(100); } } read the first parts of http://ww1.microchip.com/downloads/en/AppNotes/00746a.pdfalong with appendix F for a schematic
|
|
|
|
« Last Edit: March 30, 2010, 10:53:14 pm by Osgeld »
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
|