Performing a loop every 10ms


Closed Thread
Results 1 to 40 of 41

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sayzer View Post
    ??

    Minimum?

    Maximum?

    I must be on the other side of the mirror.


    The other side of the Bosphor, certainly !!!

    1x 1µs = 1µs ... 256x 1µs = 256µs ...

    so, the maximum period is 256 µs ...

    what was requested for, is a period duration of 10 ms ... or a 10,000 timer count !

    Tell me if I'm wrong !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    The other side of the Bosphor, certainly !!!

    Alain
    Depends on what side you are standing at.


    Quote Originally Posted by Acetronics View Post
    1x 1µs = 1µs ... 256x 1µs = 256µs ...

    so, the maximum period is 256 µs ...

    what was requested for, is a period duration of 10 ms ... or a 10,000 timer count !

    Tell me if I'm wrong !!!

    Alain
    The "maximum" means fastest then.

    Also, what do we get from TMR0 at 4Mhz at 1:4 prescaler ?
    I get roughly 1.03ms.

    I may be doing a wrong math here.
    Last edited by sayzer; - 8th February 2008 at 19:11.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Feb 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Thankyou

    Wow, thankyou for all of your replies.

    I forgot to mention that my crystal is 20MHz and both CCP1 and CCP2 are being used for HPWM.

    I found PicMultiCalc and it is saying that I can use the 8-bit timer (Timer0) for an error of 0.371%. It says that if I use the 16-bit timer I will get an error of 0%. Now I have decided that I will use the 16-bit timer only if it won't interupt my HPWM. The HPWM is driving two motors. I am not at all familure with these timers and I don't know how to set them up or know when to start my 10ms loop so that the gyro can be read at the start of every loop at 100Hz (10ms intervals). Integration calculations and other processes are carried out after the gyro has been read. If all calculations and procesess have been done before the next loop should start, the processor should wait until the timer flag or whatever signals the loop to start over.

    FYI I am making a balancing robot.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by wasssup1990 View Post
    Wow, thankyou for all of your replies.
    Said it before, I'll say it again...
    Start simple...
    Get the LED blinking at a known rate under an interrupt drive (or just get an LED blinking ), get the HPWM working on all channels in all situations, get the interfaces working, THEN tie them all together.
    Otherwise you'll be shooting yourself in the foot wondering why...no more...just wondering WHY!!!!

  5. #5
    Join Date
    Feb 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Smile

    Well ok; so it's just a trial and error thing then? I'll just experiment with the PICMULTICALC values by plugging them into the right registers and i'll see how I go. BTW I have no idea of how to use an interupt. Anyhelp in using interupts in PBP relating to what I need will be very much appriciated.
    I was hoping someone here has done what I want done before. Or perhaps someone could link me somewhere, but thanks for all of your help.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by wasssup1990 View Post
    Well ok; so it's just a trial and error thing then? I'll just experiment with the PICMULTICALC values by plugging them into the right registers and i'll see how I go. BTW I have no idea of how to use an interupt. Anyhelp in using interupts in PBP relating to what I need will be very much appriciated.
    I was hoping someone here has done what I want done before. Or perhaps someone could link me somewhere, but thanks for all of your help.
    The old 'inverted pendulum' trick has been done a lot by various people using various processors...but in the end, it's all up to the guy behind the keyboard.
    Read the book, work your way up to it...otherwise, again, your foot will end up with holes in it...

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by wasssup1990 View Post
    FYI I am making a balancing robot.
    You should browse the parallax site ...

    They already did it ( and they share it !!! ) ... and moreover their basic is PbP compatible !!!

    ... at least TONS of understandable solutions to your headaches ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  8. #8
    Join Date
    Feb 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    I saw that balancing robot on the paralax website. It doesn't use a gyro and an accelerometer. Useless on a sloped surface.

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by wasssup1990 View Post
    I saw that balancing robot on the paralax website. It doesn't use a gyro and an accelerometer. Useless on a sloped surface.
    Differential GPS, one on each corner of a 4 cornered base... Solves everything!

  10. #10
    Join Date
    Feb 2008
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    Ok I got the timer going, but brace yourself for a possible kalman filter question. I havn't found a single website that can explain kalman filters in laymens terms.

  11. #11
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Post

    Quote Originally Posted by wasssup1990 View Post
    I saw that balancing robot on the paralax website. It doesn't use a gyro and an accelerometer. Useless on a sloped surface.

    ... ROFL !!

    THEY show you how to interface with the sensors, YOU write the program for your own requirements and dreams, with YOUR sensors.

    Not just a cut and paste party ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Controlsystem for compact sporting (clay shooting)
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th July 2009, 16:48
  2. Serin to Serin2 ??
    By Gixxer in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th January 2008, 03:56
  3. Serial Relays
    By tazntex in forum General
    Replies: 3
    Last Post: - 17th May 2007, 17:42
  4. newbie Q - edge detection?
    By RMCRAVEN in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 9th October 2006, 08:20
  5. Newbie question:
    By Izone in forum mel PIC BASIC
    Replies: 2
    Last Post: - 26th February 2006, 16:24

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