Shop OBEX P1 Docs P2 Docs Learn Events
Question about assembly code — Parallax Forums

Question about assembly code

SSkalkoSSkalko Posts: 9
edited 2011-04-11 21:02 in Propeller 1
I recently decided to make an assembly driver for a TI ADS 1252, a 24 bit ADC just to see if there was any value for my application over a 12 bit ADC. It also seemed like a great way to improve my PASM skills.

My problem is I ran into some chip behavior that I wasn't expecting.
VAR

long    cog, cPin

long    Pout
long    CLK
long    dPin
long    sPin

Pub Start( cPinx, dPinx, sPinx) : okay

' cPin connected to CLK pin on ADS1252 
' dPin connected to DOUT/DRDY pin on ADS1252
' sPin connected to SCLK pin on ADS1252
longfill(@Pout, 0, 4)
cPin := |< cPinx
sPin := |< sPinx
dPin := |< dPinx
Pout := cPin | sPin
CLK := %00100 << 26 + cPinx 


okay := cog := cognew(@entry, @Pout)

Pub Stop

cogstop(cog)

DAT
          org
entry   mov             t1, par
          rdlong          Pinout, t1
          or              dira, PinOut

          add             t1, #4
          rdlong          aCLK, t1
          mov             CTRa, aCLK

          mov             frqa, CtraFreq
          add             t1, #4
          rdlong          aDAT, t1

          add             t1, #4
          rdlong          aSER, t1

          waitpeq         aDAT, aDAT
          waitpne         aDAT, aDAT
          waitpeq         aDAT, aDAT
          waitpne         aDAT, aDAT
          or              outa, aSER                    
              
        



'----------------------------------------------------------------


CtraFreq                long    054_100_000
       

t1      res   1
aCLK    res   1
Pinout  res   1
aDAT    res   1
aSER    res   1

Basically, I was using my Propscope to look the serial pin to go high and staying high after the ADS 1252 had sent a certain signal on the data pin. However, what I got was all 3 of the pins used in this driver going high. Even the clock pin which shouldn't be affected by the ADC behavior.

Any help correcting my mistaken impressions would be appreciated.

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-04-11 20:35
    This may not be the only issue here but could you please terminate your PASM code with e.g. waitpeq $, #0 and try again? Just because you stop writing code doesn't mean execution stops.
  • SSkalkoSSkalko Posts: 9
    edited 2011-04-11 21:02
    Sorry, this is code is progress. The waitpeq $, #0 trick gave me my CLK signal back. Much obliged
Sign In or Register to comment.