Shop OBEX P1 Docs P2 Docs Learn Events
MAX1497 ADC If you Are working on, please make yourself known here. — Parallax Forums

MAX1497 ADC If you Are working on, please make yourself known here.

CelticLordCelticLord Posts: 50
edited 2014-10-04 17:49 in General Discussion
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..
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 &#61574;&#61573;&#61569;
    waitcnt(clkfreq / 100000 + cnt)             '     Low 100ms  10000000
    outa[Dpin] := oValue & 1                    '  AND Bit0 position, send to Max1497 DIN
    outa[Clk]  := True                          '  Cycle SCLK Clock &#61569;&#61570;&#61574;&#8593;
    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 &#61569;&#61570;&#61574;                        
    waitcnt(clkfreq / 100000 + cnt)             '     High 100ms
    outa[Cpin]  := False                        '  Cycle SCLK Clock &#61574;&#61573;&#61569;&#8595;
    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
975 x 497 - 64K

Comments

  • JonnyMacJonnyMac Posts: 9,108
    edited 2014-10-02 19:00
    How many threads are you going to start on this same topic? As with being rude to those attempting to help (like you were toward Duane), starting mulitple threads on the same topic will not warm the hearts of fellow forum members.

    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).
  • CelticLordCelticLord Posts: 50
    edited 2014-10-03 07:29
    Thanks Jonny.
    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.
  • JonnyMacJonnyMac Posts: 9,108
    edited 2014-10-03 09:16
    My name is Jon (see signature).

    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.
  • CelticLordCelticLord Posts: 50
    edited 2014-10-03 15:22
    I do see the signature JONNYmac see Jonny
    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
  • JonnyMacJonnyMac Posts: 9,108
    edited 2014-10-03 17:30
    My maker/hacker handle is JonnyMac. My signature (below), shows my actual name: Jon McPhalen.

    Good luck getting help down the road; you're going to need it.
  • ercoerco Posts: 20,256
    edited 2014-10-03 17:58
    Congrats on setting a new forum record, CelticLord. In fewer than 2^5 posts, you've managed to alienate two of the smartest and most helpful members of the forum.

    An attitude of gratitude goes a long way, especially when you're asking for help.
  • frank freedmanfrank freedman Posts: 1,983
    edited 2014-10-04 12:44
    JonnyMac wrote: »
    My maker/hacker handle is JonnyMac. My signature (below), shows my actual name: Jon McPhalen.

    Good luck getting help down the road; you're going to need it.

    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
  • idbruceidbruce Posts: 6,197
    edited 2014-10-04 17:49
    Alright..... Now I am curious..... Where is the original thread? I would like to see what he said to Duane.

    @CelticLord
    As mentioned, Duane is very knowledgable, friendly, and helpful, and probably one of the nicest people in the forum. Addiditionally, he is well respected by his peers in the forum. Likewise, Jon is also very knowledgable and helpful, and he is probably one of the most successful uC designers in the forum, and also well respected amongst his peers.

    Occasionally tempers fly and rudeness pops out, but you would be wise to choose you battles carefully and who you offend.
Sign In or Register to comment.