Questions on timing


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Amazing what a coffee can do !

    I've got something working now. I created a variable called time and then changed the music section to

    Code:
    music:
    if sw1=0 then swcount=swcount+1     ;cycles through the patterns by adding 1 to SWcount
    pause 70                            ;debounce delay
    If swcount >7 then swcount=1        ;error trap for exceeding max patterns                        
    gosub sel1                          ;go to subroutine to select pattern based on SWcount value
    If mus = 1 then counts = counts+1
    if mus = 0 then time = time +1
    gosub sel2                          ;go to subroutine to display pattern in current step
    If counts = steps then counts = 0  ;if counts then reset counts to 1
    if time = 20 then goto chase
    goto music:
    works fine... just got to try the value for the jump to chase with some music (young one's asleep on the sofa at the moment.. so it will have to wait !)

    Sorry for the waste of space on the server.. but I had been trying to get this working for hours before the cafine break !

  2. #2
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile Both sides

    Hi Malcolm,

    Anytime, someone posts a question, it helps others with a similar problem.

    Anytime, someone posts an answer, it helps everyone learn.

    Just because, you posted the question AND the answer, doesn't mean it is not helpful.

    (But, it did cause me to go get a cup of coffee...)

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Adam,

    Thanks, for the comments, and I hope that someone somewhere might find my problem and answer useful ! I think it was the fact that I needed to walk away from the problem, have a caffine fix and then look at the problem afresh... seemed to work this time !

  4. #4
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default Bits, bytes and bobs !

    Ok having run this in real time I have a problem. The variable time is byte, and so the maximum value I can have is 254. But setting the "if time = 254 then goto chase" still gives too short a period before the jump is made. I don't want to use a pause statement as that will cause the program to miss the odd beat whilst its waiting... What is the correct designation I should use for the varible, so I could increase the value to something like "if time = 1000 then goto chase" - is it var WORD ???

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    yes it is.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. General USB questions
    By BobEdge in forum USB
    Replies: 2
    Last Post: - 21st April 2009, 04:19
  2. 18F2550 timing
    By sstt1976 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 22nd August 2008, 00:30
  3. Two quick (and elementary) questions.
    By scorpion990 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th June 2008, 23:03
  4. A few 12F683 questions
    By dhouston in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th May 2008, 03:54
  5. timing questions with different oscillators
    By glkosec in forum General
    Replies: 1
    Last Post: - 22nd August 2007, 05:42

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts