Shop OBEX P1 Docs P2 Docs Learn Events
event counting — Parallax Forums

event counting

doggingtondoggington Posts: 2
edited 2009-08-01 02:09 in Accessories
Hi all
I have been useing the bs2 for· a while for simple machine control, with basic IF THEN· sort of programming. INPUTS· are generally from IR sensors and OUTPUTS· are to motors or solenoid valves. I have now got to the point of trying to control position by using a rotating threaded rod and an indexed plate with holes to to ·cause pulses in an IR sensor. the code I use is lifted from the stampworks manual (i think).
Code attached.
My problem is that whilst this code counts at slow speed, the shaft is rotating at the speed of a cordless drill motor without its gearbox this is too fast.

can anyone give me some code that will cope or tell me how fast I can make the shaft rotate without missing a pulse?

Comments

  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-07-31 22:49
    doggington

    Welcome to the Parallax Forum
    First········· You need to·define ALL of you·PINs with name which make it easier to follow your code
    Second····· You need to put ALL CON at the top of your code
    Third········· You need to put RETURN after ALL SUB Routine in your·code



    Please look at attachment bellow

    Please read through the What is a Micro-Controller this will help you a lot

    ······························· ^^^^click above ^^^^ on the line

    Stamp Work······ page 98

    ·My problem is that whilst this code counts at slow speed, the shaft is rotating at the speed of a cordless drill motor without its gearbox this is too fast.· Yes ·this maybel· to fast to count

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 7/31/2009 11:20:24 PM GMT
  • FranklinFranklin Posts: 4,747
    edited 2009-07-31 22:52
    You will need to add additional hardware to do the counting, the stamp is not fast enough to keep up and can only do one thing at a time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • kwinnkwinn Posts: 8,697
    edited 2009-08-01 02:09
    Either a faster micro like the propeller or a prescaler (1/2/4/8 bit counter) between the bs2 and the sensor. Of course this will reduce positioning accuracy unless you compensate in some manner.
Sign In or Register to comment.