New project help rapidfire on 12f683


Closed Thread
Results 1 to 28 of 28

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by thm ov3rkill View Post
    hey Joe thanks alot How would i do it would you provide me with a example or somthing I tried doing this but it only shoots one shot and thats it Also do you happen to have aim or some sort of Instant messaging Here is my code I dont know what needs to be done i also dont know anything about settings.
    Code:
    led var gpio.4
    leftbutton var gpio.3
    cnt var byte
    
    CLEAR  
    
     
     LOOP1:
      iF LEFTBUTTON = 1 THEN 
      GOTO LOOP2
     ENDIF 
     led=1
    pause 62
    led=0
    pause 62
    goto LOOP1
    '**************************************************
    LOOP2:
    for cnt = 1 to 3
    led=1
    pause 35
    led=0
    pause 35
    next cnt 
    pause 250
     IF LEFTBUTTON = 1 THEN 
     GOTO LOOP1
     ENDIF
     GOTO LOOP2
    Looks like you are trying to create a 3 round burst fire simulation, correct? If so you must also create a Virtual Disconnector too, a subroutine loop to stay in while waiting for the trigger to be released. Put it's call in the 3 round subroutine. Something like . . .
    Code:
    main:
    If Trigger then fire
    goto main
    
    fire: 
    . . . code to flash led 3 times
    goto Disconnect
    
    Disconnect:
    if trigger = 1 then
    goto  disconnect
    else
    goto main
    endif
    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
    Dec 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Looks like you are trying to create a 3 round burst fire simulation, correct? If so you must also create a Virtual Disconnector too, a subroutine loop to stay in while waiting for the trigger to be released. Put it's call in the 3 round subroutine. Something like . . .
    Code:
    main:
    If Trigger then fire
    goto main
    
    fire: 
    . . . code to flash led 3 times
    goto Disconnect
    
    Disconnect:
    if trigger = 1 then
    goto  disconnect
    else
    goto main
    endif


    thank you very much joe I see what your saying WIth the triggers But for now that code up there was orginally for no triggers just external buttons that send the rapid low pulses. the loop one is rapidfire auto and loop 2 is burst. What i want to know if i attach a switch to ground than gpio.3 and when the switch is hit once it will go into loop1 or mode 1 which is auto rapidfire and if the swithch is hit one more time it goes in loop2 or mode 2 for the burst so its basically a 2 mode rapidfire and agin the 2 mode is external after i get it working it will move on to the orignal triggers. thanks joe

    EDIT: On the code you wrote can I add a option to turn on and of the rapid fire I mean I know I can jsut do this for example
    if buttoncheak = 1 than
    sleep 6
    else
    goto main something like thta but where would i add it.
    Last edited by thm ov3rkill; - 22nd December 2008 at 02:42.

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


    Did you find this post helpful? Yes | No

    Default

    On the code you wrote can I add an option to turn on, and off the rapid fire ? I mean I know I can just do this for example
    if buttoncheck = 1 then
    sleep 6
    else
    goto main something like that but where would i add it.
    Yes, you can. Think in terms of 2 loops each checking the switch. 1 loop elses into the main loop which loops back into the loop, but if true it goes to loop 2 which loops into itself unless true, effectively giving you an on off toggle.
    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
    Dec 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Yes, you can. Think in terms of 2 loops each checking the switch. 1 loop elses into the main loop which loops back into the loop, but if true it goes to loop 2 which loops into itself unless true, effectively giving you an on off toggle.
    Hi , Joe
    thanks for all your help so forth really appreciate it alot

    I have a couple questions

    For example if i make that trigger rapidfire can it read the low coming from trigger when its being pulled and rapidfire from the same pin at once i made a little digram It doesent have to be thoe pins just did them because there closer in the digram the trigger joint is the middle one to make the on/of toggle what command would i use sleep or what?? also i was thinking of making the on off switch as a mode select for example..

    when I turn the controller on It goes in mode 1 automatically. Then if I hit the tact switch attached to ground and one of the pins on chip it would go in mode 2 and stay on there untill I hit the switch. If the switch is pressed one more time it will turn rapidfire off and if i hit it one more time it would go in mode 1 like it started on also how would I make the modes I would use the if then but I dont know if i can use the same one again. here is the digram for example.

    sorry for the messed up words as i do not have a steady hand

    Last edited by thm ov3rkill; - 22nd December 2008 at 15:14.

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


    Did you find this post helpful? Yes | No

    Default

    This should give you an Idea:
    Code:
    mode var byte
    mode_switch var gpio.3
    
    start:
    if mode_switch = 1 then
    mode = mode + 1
    else
     goto main
    endif
    
    main:
    if mode = 0 then
    goto normal
    if mode = 1 then
    goto burst
    if mode = 2 then
    goto rapid
    if mode = 4 then
    mode = 0
    else 
    goto start
    endif
    endif
    endif
    endif
    normal:
    
    rapid:
    
    burst:
    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
    Dec 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    hey joe what mode should i use the turn the rapidfire off i can make it go to sleep. the most it can sleep for is 19 hours but i hihgly doubt anyone will play for that long also im a bit confused on that code


    what will i write to cheak for the button switch cause if i put it as main it will jsut restart thansk joe
    Last edited by thm ov3rkill; - 23rd December 2008 at 01:59.

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by thm ov3rkill View Post
    hey joe what mode should i use the turn the rapidfire off i can make it go to sleep. the most it can sleep for is 19 hours but i hihgly doubt anyone will play for that long also im a bit confused on that code

    what will i write to cheak for the button switch cause if i put it as main it will jsut restart thansk joe
    First off, why not trying to type a bit slower or something, maybe add something like punctuation. Makes it just that much easier for the rest of us to read.
    Second...You might want to try and write out exactly what you want your 'buttons' to do, flowchart the whole thing.
    I'm reading through this and your other threads over at Microchip, and your ideas are half-structured at best. You seem to be hoping that somebody will just come up with the magic code for you and it'll all be done.
    Joe's code, a couple of posts above, is a good base for you to add onto. I think the end result that you desire is just as easy as what Joe has written up. Why not just try a few things here and there? Then, when things don't work as expected, post the code YOU wrote and the rest of us can help YOU figure out what YOU did wrong, rather than the other way around. As has been said here before, this isn't a 'drive-thru get your code' forum, although a few would be more than happy to write the code for you, I don't know of any.
    After that, you might want to hit the books a little bit and do some reading on the SLEEP command for putting your PIC into SLEEP mode.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. 12f683 help!!!! L@@K!!!
    By thm ov3rkill in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd December 2008, 22:46
  3. A Temperature & Humidity Data Recorder Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 9th July 2008, 18:47
  4. Help on coding/ selecting PIC chip for project
    By lovemeok in forum General
    Replies: 0
    Last Post: - 27th July 2006, 19:21
  5. A category for Project Ideas
    By Pic_User in forum Forum Requests
    Replies: 2
    Last Post: - 23rd June 2006, 07:29

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