Counting better ?


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Franko's Avatar
    Franko Guest


    Did you find this post helpful? Yes | No

    Default

    Yettie,
    Your right, I'm going about it in the wrong way. I am trying to count the pulses at the DATAPLS pin, NOT to measure the time it's high.

    You have indeed enlightened me, I'll keep working at it.

    Thank you very much !

  2. #2
    Join Date
    Aug 2005
    Location
    antipolo city, philippines
    Posts
    23


    Did you find this post helpful? Yes | No

    Smile welcome...

    franko,

    good day!

    i hope you will share your conclusions after all this just let me know. ok?

    regards,
    yettie

    We should learn "KISS" - Keep It Simple Stupid...

  3. #3
    Franko's Avatar
    Franko Guest


    Did you find this post helpful? Yes | No

    Default

    I sure will. Providing I come to a conclusion.

    I'll keep at it.

  4. #4
    Franko's Avatar
    Franko Guest


    Did you find this post helpful? Yes | No

    Default

    Well,
    Here is how I got it to count 4 pulses and stop "Hmtr". This works perfect every time although I'm sure there is a way that I could be able to just change a single number from say 4 to 5 in order to change the count, I just haven't figured it out yet.

    But, if the last pulse doesn't occur at (While DATAPLS=0) the motor continues to run. Of course.

    Can I use Timer1 ETC. to set a maximum motor run time of say 10 sec. ?

    Thanks, I appreciate any help.




    Code:
    High Hmtr						
    Pause 10
    While DATAPLS=0
    Wend
    Low Hmtr
    Pause 50
    
    High Hmtr						
    Pause 10
    While DATAPLS=0
    Wend
    Low Hmtr
    Pause 50
    
    High Hmtr						
    Pause 10
    While DATAPLS=0
    Wend
    Low Hmtr
    Pause 50
    
    High Hmtr						
    Pause 10
    While DATAPLS=0 
    Wend
    Low Hmtr
    Pause 50
    
    GoTo Startloop

  5. #5
    Join Date
    Aug 2005
    Location
    antipolo city, philippines
    Posts
    23


    Did you find this post helpful? Yes | No

    Default yep...

    franko,

    yes, you can use TIMER1 module. provided that you initialized it properly and then poll a counter if it reached a 10s mark. I've been using TIMER1 register for some time. A advice you set the prescaler to 1:8 setting since you have a way to long to wait.

    I could have just gave you some of ideas since it will be more satisfying if you find it yourself.

    have a nice day!

    regards,
    yettie

    We should learn "KISS" - Keep It Simple Stupid...

  6. #6
    Franko's Avatar
    Franko Guest


    Did you find this post helpful? Yes | No

    Default

    Will the timer run independently from the main code ? Like "in the background" ?

    I ask this since the main program will be stuck at the (While) statement.

    Thanks

  7. #7
    Join Date
    Aug 2005
    Location
    antipolo city, philippines
    Posts
    23


    Did you find this post helpful? Yes | No

    Default like a thread...

    franko,

    yes. once the initialization process of TIMER1 interrupt is complete and activating the start of counter, the timer will run in background as you work on your main code. it will only then be entering the interrupt service routine once it reached the overflow anytime and anywhere while you are working on your main routine.

    regards,
    yettie

    We should learn "KISS" - Keep It Simple Stupid...

Similar Threads

  1. COUNT is not counting again
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 19th June 2009, 04:52
  2. Remain counting while sending out a pulse
    By ultiblade in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th January 2007, 15:51
  3. hardware counting while software runs
    By Archangel in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd October 2006, 03:26
  4. continious counting process (capture)
    By asynch in forum General
    Replies: 1
    Last Post: - 17th February 2006, 07:42
  5. Counting Button Pushes
    By Tissy in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 27th November 2005, 22:10

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