Shop OBEX P1 Docs P2 Docs Learn Events
stuck with the counter modules lab — Parallax Forums

stuck with the counter modules lab

RontopiaRontopia Posts: 139
edited 2008-03-14 19:13 in Propeller 1
I have a cap that gos from pin 17 to the + side of the cap and the - is connected to gnd.. I have a Varible resistor conneted to pin 17 and the other side to gnd.

here is the code, I copied from the lab..
''TestRcDecay.spin
''Test RC Decay circuit decay measurements
Con
        _clkmode = xtal1 + pll16x                       'sets system clock to 80MHz
        _xinfreq = 5_000_000
OBJ
        Debug: "FullDuplexSerialPlus"                   'use Hyper Terminal to display values
PUB Init
    'start serial communication, and wait 3s for user to connect to Hyper Terminal.
    Debug.start(31, 30 , 0, 57600)
    waitcnt(clkfreq * 3 + cnt)
    'configure counter mode
    ctra[noparse][[/noparse]30..26] := %01000                              'set mode to POS detector
    ctra[noparse][[/noparse]5..0] := 17                                    'set Apin to 17 (P17)
    frqa := 1                                           'Increment phsa by 1 for each clokc tick
PUB Main | time
    'Repeatedly takes and desplays P17 RC decay measurements.
    repeat
      'charge RC Circuit
      
      dira[noparse][[/noparse]17] := outa[noparse][[/noparse]17] := 1                         'set pin to output high
      waitcnt(clkfreq/100_000 + cnt)                    'delay to let cap charge
    ' Start RC decay time measurement.  Its automatice after this.
      phsa~
      dira[noparse][[/noparse]17]~
      debug.str(String(10, 10, 13, "working on other tasks"))
      repeat 10
        Debug.tx(".")
        waitcnt(clkfreq/30 + cnt)
    ' measurment has been ready for a while. Adjust ticeks between phas~ and dira[noparse][[/noparse]17]~.
      time := (phsa - 624) #> 0
    ' display result
      Debug.Str(String(10, 13, "time = "))
      Debug.Dec(time)
      Waitcnt (clkfreq/2 + cnt) (replace this text with your code)

so I load the eprom and nothing happens. I actually put and led of pin 17 with a 100 ohm resistor to see if pin 17 was doing anything at all and its not, or at least if it is charging the it, its happening to fast for me to see.
Im sure its something to do·with the way I·have·copied the code..·but i cant seem to find.

Thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



IC layout designer
Austin Texas

Comments

  • RontopiaRontopia Posts: 139
    edited 2008-03-14 19:13
    oops.. sorry..

    i forgot to call the main method.. sorry sorry

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



    IC layout designer
    Austin Texas
Sign In or Register to comment.