Shop OBEX P1 Docs P2 Docs Learn Events
Help with debugging count command please! — Parallax Forums

Help with debugging count command please!

ArchiverArchiver Posts: 46,084
edited 2004-04-16 21:52 in General Discussion
I have the following snippet in my code:

Ign VAR Word 'Declare variable to hold number of pulses
Ign = 0
Main:

'Count pulses on input pin
COUNT 1,1000,Ign
DEBUG Ign 'Debugging - output the variable amount.


To test it I have put in the debug command as shown, but nothing
appears. I tried commenting out the Count command, thinking that it
should at least show zero as shown, but it doesn't. Other debug stuff
is fine (i.e. Debug "Hello world"!) but this isn't doing a thing. Bit
stumped, help!
James

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-16 20:55
    You need to tell the DEBUG window what format to use when you want to
    display number -- you have to covnert numeric values to an ASCII string
    before sending to DEBUG. Change your DEBUG line to this:

    DEBUG DEC ign

    Any value less that 32 that gets sent to the DEBUG window will be
    interpreted as a control code. Using the DEC (or HEX or BIN) modifier
    changes the value to an ASCII string that can be displayed without
    trouble.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: james.billings@n... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=-givI406EUQ1tuYaIXc-RYFlIm8m5Enuwe_HDR5ku7CHzq2LkUccK0Y4KByaARXzMNS0gKLRJEZsVVsuJ_rZ1FSZkAoViA]james.billings@n...[/url
    Sent: Friday, April 16, 2004 2:41 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Help with debugging count command please!


    I have the following snippet in my code:

    Ign VAR Word 'Declare variable to hold number of pulses
    Ign = 0
    Main:

    'Count pulses on input pin
    COUNT 1,1000,Ign
    DEBUG Ign 'Debugging - output the variable amount.


    To test it I have put in the debug command as shown, but nothing
    appears. I tried commenting out the Count command, thinking that it
    should at least show zero as shown, but it doesn't. Other debug stuff
    is fine (i.e. Debug "Hello world"!) but this isn't doing a thing. Bit
    stumped, help!
    James
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-16 21:01
    Thanks Jon, that worked a treat. Just need to get it to actually
    count now - thats more of a circuit problem I think though. One
    question - the instructions say Count treats a single count as a 0-1-
    0 type signal - does the 0 need to be an actual grounded voltage? I
    am trying to use it to measure a pulsed 12v voltage and my circuit
    goes through an opto isolator, but I am wondering if nothing-12v-
    nothing is going to be different to 0v-12v-0v?
    James

    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > You need to tell the DEBUG window what format to use when you want
    to
    > display number -- you have to covnert numeric values to an ASCII
    string
    > before sending to DEBUG. Change your DEBUG line to this:
    >
    > DEBUG DEC ign
    >
    > Any value less that 32 that gets sent to the DEBUG window will be
    > interpreted as a control code. Using the DEC (or HEX or BIN)
    modifier
    > changes the value to an ASCII string that can be displayed without
    > trouble.
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-16 21:52
    The BASIC Stamp 0-1 switching threshold is about 1.5 volts. You need to
    make sure that your zero swing is below that (ideally, ground), and your
    1 swing above it (ideally, +5). You should probably make sure your
    "nothing" becomes ground by using a pull-down -- don't let it float as
    this will probably give you unreliable results.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: james.billings@n... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=gTnaE_NDl1hzxfPViBSRn0XNaEcTocrfli65eETczxUVSZ5ALpFQ9JDStSaoptvAviWMLa7hX9ZvV6DB5JdMQSTYjKD4]james.billings@n...[/url
    Sent: Friday, April 16, 2004 3:02 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Re: Help with debugging count command please!


    Thanks Jon, that worked a treat. Just need to get it to actually
    count now - thats more of a circuit problem I think though. One
    question - the instructions say Count treats a single count as a 0-1- 0
    type signal - does the 0 need to be an actual grounded voltage? I
    am trying to use it to measure a pulsed 12v voltage and my circuit
    goes through an opto isolator, but I am wondering if nothing-12v-
    nothing is going to be different to 0v-12v-0v? James

    --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
    wrote:
    > You need to tell the DEBUG window what format to use when you want
    to
    > display number -- you have to covnert numeric values to an ASCII
    string
    > before sending to DEBUG. Change your DEBUG line to this:
    >
    > DEBUG DEC ign
    >
    > Any value less that 32 that gets sent to the DEBUG window will be
    > interpreted as a control code. Using the DEC (or HEX or BIN)
    modifier
    > changes the value to an ASCII string that can be displayed without
    > trouble.
    >




    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.

    Yahoo! Groups Links







    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
Sign In or Register to comment.