Controlsystem for compact sporting (clay shooting)


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    If three shooters they will start on stand 1, 2, 3 and after the menu move to 2, 3 and 4 and then to 3, 4, 5 and then to 4, 5, 1 and that last shooting on stand 5, 1, 2.
    Do I understand correctly . . . You want to DeSelect the unused stands from automatically throwing the clay? So you would throw in sequence 123, 234, 345, 451, 512 for 3 shooters . . . 1234, 2345, 3451, 4512, 5123 for four shooters . . . ? You should be able to do that using an array and shift the bits over.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Yes thatīs correct.
    How do i do an Array and shift bits, do you have an short example?

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Fredrick View Post
    Yes thatīs correct.
    How do i do an Array and shift bits, do you have an short example?
    Got 1 ready now, incomplete but it serves as example, change the shooters var to change lights lit
    Code:
    @MyConfig = _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON  
    @MyConfig = MyConfig & _MCLRE_ON & _BOR_OFF 
    @ __config  MyConfig 
    include "modedefs.bas"
    DEFINE OSC 4
    PortA = 0
    PortB = 0
    PortC = 0
    TRISA = 1
    TRISB = 0
    TRISC = %00000000
    i var word 'locks up @ 255 with byte
    ANSEL = 0
    ANSELH = 0
    CM1CON0 = 0
    CM2CON0 = 0
    shooters var byte
    total var byte
    serout PortA.2,t9600,["enter shooters"]
    ' too lazy to do input routine
    shooters = 2
    
    lookup shooters -1,[1,3,7,15,31],total
    main:
    portc = 0
    'pause 200
    for i = total  to 255
    portC = i
    i=i  << 1-1
    pause 500
    next i
    i=0
    portC = i
    pause 500
    
    goto main
    end
    not a typical array as we normally see them, but it works using pickit2 & lowpin demo board
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Sorry... but I donīt understand how to do the program with the lookup function.

    Where comes the numbers [1,3,7,15,31] from and what does it do?

    How to i use the lookup to point the program to the right loop that contains the right clay combination?

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Fredrick View Post
    Sorry... but I donīt understand how to do the program with the lookup function.

    Where comes the numbers [1,3,7,15,31] from and what does it do?

    How to i use the lookup to point the program to the right loop that contains the right clay combination?
    What does it do . . . It tells your program how many shooters are there, from the input I was too lazy to code for you. You get that input from a key routine or waste 5 ports as inputs, either way you answer the question, how many shooters. I answered it by coding shooters = 2, you I expect will want to select 1 to 5 at will.
    The numbers in the lookup table are decimal representations of their binary equivalent. Think of PortC as a 8 digit binary display, 1 would light just bit 0, 3 would light bits.0:1, 7 lights bits 1:3 . . . I urge you to try this code snippet and alter the numbers and see what it does. The lookup table just makes the counter count read differently, when it sees 1 it reports 1, 2 it reports 3, 3 it reports 7 . . . in binary. The -1 in the lookup just makes 0 invalid as you would never have 0 shooters.
    Last edited by Archangel; - 27th July 2009 at 07:47.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Ok now I understand the function of LOOKUP but i donīt know how to use it to jump to the right loops when the number of shooter changes.

    This is how the shooting sequence look like


    When there are five shooters, one on each stand they shoot as in the diagram above. and then they move one steep right and the guy on stand 5 move to the stand 1 and the shooting sequence starts from STAND 1 again and so on.... until all shooters have shoot from all 5 stands.

    But if there are 3 shooters the shooting sequence will look like this.
    1st run
    LOOP 1
    LOOP 2
    LOOP 3

    LOOP 6
    LOOP 7
    LOOP 8

    LOOP 11
    LOOP 12
    LOOP 13

    2:e run

    LOOP 2
    LOOP 3
    LOOP 4

    LOOP 7
    LOOP 8
    LOOP 9

    LOOP 12
    LOOP 13
    LOOP 14

    3: run
    LOOP 3
    LOOP 4
    LOOP 5

    LOOP 8
    LOOP 9
    LOOP 10

    LOOP 13
    LOOP 14
    LOOP 15

    4:run
    LOOP 4
    LOOP 5
    LOOP 1

    LOOP 9
    LOOP 10
    LOOP 6

    LOOP 14
    LOOP 15
    LOOP 11

    5:e and last run
    LOOP 5
    LOOP 1
    LOOP 2

    LOOP 10
    LOOP 6
    LOOP 7

    LOOP 15
    LOOP 11
    LOOP 12

  7. #7
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    The LOOKUP code will only work for the first 3 loops if there are 3 shooters.. or?

Members who have read this thread : 1

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