MAX1497 ADC If you Are working on, please make yourself known here.
CelticLord
Posts: 50
I am also trying to get this chip working, here's what I have so far....
1. MaxOut I have the bits being sent out to it, but they need to be in reverse I.E. binary 130 for example 100000010 would be sent to MaxOut as binary 65 010000001.
there is no other way except making code clutter, large, and complex
2. MaxIn Code works but chip seems not to be sending anything but 0.
Not sure whats going on at this point. The setup code is ........
....Bit 15......Bit14......Bit13......Bit12......Bit11......Bit10......Bit 9......Bit 8......Bit 7......Bit 6......Bit 5......Bit 4......Bit 3......Bit 2 .....Bit 1......Bit 0
SPI/ADC EXTCLK INTREF DPON DPSET2 DPSET1 DP_DIG PD_ANA HOLD PEAK RANGE CLR SESEL OSET1 OSET2 ENABLE
.......0.............1...........1.............0............0...........0............0..........0...........0.............0...........0..........0...........0...........0..........0...........0
Hopeing There Are More Of You Out There Working On This, Please post what you have.
Here is the code I have..
1. MaxOut I have the bits being sent out to it, but they need to be in reverse I.E. binary 130 for example 100000010 would be sent to MaxOut as binary 65 010000001.
there is no other way except making code clutter, large, and complex
2. MaxIn Code works but chip seems not to be sending anything but 0.
Not sure whats going on at this point. The setup code is ........
....Bit 15......Bit14......Bit13......Bit12......Bit11......Bit10......Bit 9......Bit 8......Bit 7......Bit 6......Bit 5......Bit 4......Bit 3......Bit 2 .....Bit 1......Bit 0
SPI/ADC EXTCLK INTREF DPON DPSET2 DPSET1 DP_DIG PD_ANA HOLD PEAK RANGE CLR SESEL OSET1 OSET2 ENABLE
.......0.............1...........1.............0............0...........0............0..........0...........0.............0...........0..........0...........0...........0..........0...........0
Hopeing There Are More Of You Out There Working On This, Please post what you have.
Here is the code I have..
CON _clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 5_000_000 EOC = 4 CS = 3 ' Chip Select Clk = 1 ' Clock DIn = 2 ' DataIn DOut = 0 ' DataOut Cnts2Mv = $001F OBJ pst : "Parallax Serial Terminal Plus" BS2 : "BS2_Functions" ' Create BS2 Object VAR ' Conversion Result Long wresult1, wresult2, wValue, Num Word Volts ' Result --> mVolts Word Value, oFlip ' Result --> Value Byte Status, rFlag, Tout PUB Main ' dira[EOC] := False ' dira[DOut] := True ' dira[Clk] := True ' dira[DIn] := False ' dira[CS] := True ' outa[Clk] := True ' outa[CS] := True ' outa[CS] := False ' MaxOut (DOut, Clk, %01000001, 8) ' Enable Write to Control Register %10 00001 0 MaxOut (DOut, Clk, %0000000000000110, 16) ' Enable bit ON ,RANGE = 2.0 Volts %0110000000000000 outa[CS] := True repeat 'rFlag := 1 repeat while ina[EOC] == 1 '^ Check EOC Pin End Of Conversion '└── Repeat untill EOC 0(Data valid in ADC Result) pst.Str(String(2,1,1,"Not Ready")) 'Debug line delette pst.Str(String(2,1,1," READY ")) 'Debug line delette outa[CS] := False MaxOut (DOut, Clk, %00001011, 8) ' Enable READ ADC Result Register 1 (12 MSBs) %11010000 wresult1 := MaxIn (DIn, Clk, 12) outa[CS] := True outa[CS] := False MaxOut (DOut, Clk, %00010111, 8) ' Enable READ ADC Result Register 2 ( 8 LSBs) %11101000 wresult2 := MaxIn (DIn, Clk, 8) outa[CS] := True wValue := (wresult1 << 8) + wresult2 'Combine Result 12 Bit REG A + 8 Bit REG B pst.Str(String(2,1,4)) 'Debug line delette pst.dec(wValue) 'Debug line delette pst.Str(String(" ",13)) 'Debug line delette PUB MaxOut (Dpin, Cpin, oValue, obits) oValue := oValue <- 1 repeat obits 'Loop through all bits to send oValue >>= 1 ' Shift bits to right outa[Clk] := False ' Cycle SCLK Clock  waitcnt(clkfreq / 100000 + cnt) ' Low 100ms 10000000 outa[Dpin] := oValue & 1 ' AND Bit0 position, send to Max1497 DIN outa[Clk] := True ' Cycle SCLK Clock ↑ waitcnt(clkfreq / 100000 + cnt) ' High 100ns outa[Dpin]~ 'Set data to low PUB MaxIn (Dpin, Cpin, ibits) : iValue | InBit iValue:=0 REPEAT ibits 'Loop through all bits to recieve outa[Cpin] := True ' Cycle SCLK Clock  waitcnt(clkfreq / 100000 + cnt) ' High 100ms outa[Cpin] := False ' Cycle SCLK Clock ↓ waitcnt(clkfreq / 100000 + cnt) ' Low 100ns InBit := ina[Dpin] ' get bit value iValue := (iValue << 1) + InBit ' Add to value shifted by position pst.dec(iValue) 'Debug line delette
Comments
I showed you in another thread how to connect to the chip. It's not likely that I'll ever use the MAX1497, but as others may, I created an object for it. The object will simplify your application. Use the start() method to define the pins you're using, the write() method to write values to the device, and the read() method to read values back. Both methods support 16- or 8-bit data values
Edit: Made some after-dinner updates (a little cleaner now, added additional comments).
And by the way I wasn't being rude. Intentionally. I'm just frustrated with this dang chip and really need it to work or im stuck with the 16 bit and that dosn't really work.
I cant help it if Duane took it as being rude I tryed to put as being frustrated not rude.
Intentional or not, you were rude to one of the forum's most helpful members. That's a loss that was completely preventable. Nobody cares if you're frustrated -- that is often a part of the learning process. Taking your frustrations out on those trying to help you is beyond my comprehension. As I said in the other thread, nobody owes you anything. You're here asking for time and expertise (that is worth money) and being belligerent when you don't get exactly what you think you're entitled to.
Tips:
-- Emotion is not easily conveyed in text, so be very kind in your posts, especially when asking for help
-- "I'm sorry..." goes much farther than a lame attempt to justify one's bad behavior.
You can lash out at me if you want -- but be careful; thusfar, I'm the only person who took the time, despite your multiple posts on the same topic (bad form) and rudeness toward Duane (very bad form), to help you by writing an entire object. Yes, it was easy for me. It was because I have worked through my frustrations and have the Propeller figured out enough that I make a living designing circuits and code for it.
I didnt take my frustration out on him I just told him I didnt understand what he was talking about and he took it rude. so too bad I wasnt intentioal.
I appreciate your and his help but I dont need you to be my mother.
Now your being Rude lol
Good luck getting help down the road; you're going to need it.
An attitude of gratitude goes a long way, especially when you're asking for help.
Hey Jon,
Got a bit of a chuckle out of this. Went to his profile and there was a line in the left side bar about not making any friends yet. Guess a moderator could not add the additional phrase "and is unlikely to in any event". Perhaps the frustration comes from over promising and now may be looking at a CLM for under delivering........
Even as heated as the assembly threads were, I don't recall personal attacks like these. Perhaps the moderators could set an n-strike rule for incivility in posts.
Random thoughts,
FF
@CelticLord
Occasionally tempers fly and rudeness pops out, but you would be wise to choose you battles carefully and who you offend.