PDA

View Full Version : New project help rapidfire on 12f683



thm ov3rkill
- 21st December 2008, 01:20
hey I just recieved my PBP and I love it i made a few little led flashes and soo on but i have stumbled on this forum and i nee your help guys well there is this new thing called rapidfire on the pic 12f683 for the xbox 360 controller it well basically presses the trigger 20-30 times a second here is a link to one of th guys who sell this and i wanted to make a little project for my self.
http://www.consolecustoms.net/tutorials/360_3mode_rapid_tutorial_new.pdf
exept there rapidfire is on the acuall triggers and when the triggers are beig pulled it reads the low or high (depending on your controller model) than sends the low pulses for rapidfire
But before the rapidfire on triggers i wanted to get it to work on external buttons so look down =]

I recently made a attemp on 12f683 to not use the triggers but a external button and this is my code And when I tested it it didint really work. its a 2 mode rapidfire the first mode is fully rapidfire and when you press the button it goes in mod 2 which is a 3 round burst all i want it to do is pulse first in loop 1 then if a nutton is button is pressed which is hooke dto ground it will go into loop2 to fire in burst and i need your help guys...

Archangel
- 21st December 2008, 20:04
IMHO, Buy the chip from him AND keep working on your own version. That way during the next year you are working on your version, you can be enjoying the rapid fire advantage. I think you have underestimated the amount of work this person has done here.

thm ov3rkill
- 21st December 2008, 20:39
well i currently have my rapidfire code single mode on a momentory switch so im ine but i jsut want to get this working all help is apprecited thanks.

rmteo
- 21st December 2008, 20:55
There is a monster thread here:
http://forum.microchip.com/tm.aspx?m=353574&mpage=1&key=&#353574

thm ov3rkill
- 21st December 2008, 21:00
hey thanks for that link alot ye i been there since the first post and i know who amde the codes there codes are in asm so basic is easier for me thanks.

Archangel
- 21st December 2008, 21:23
well I currently have my rapid fire code single mode on a momentary switch so I'm fine but I just want to get this working, all help is appreciated thanks.
I would lose the button code in favor of an IF/Then loop, easier and I doubt switch bounce will be a problem.

thm ov3rkill
- 21st December 2008, 22:23
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.

Archangel
- 22nd December 2008, 00:24
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.

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 . . .


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

thm ov3rkill
- 22nd December 2008, 02:15
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 . . .


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.

Archangel
- 22nd December 2008, 04:52
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.

thm ov3rkill
- 22nd December 2008, 15:08
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 :)

http://i159.photobucket.com/albums/t128/dan7123/untitled-3.jpg

Archangel
- 22nd December 2008, 19:27
This should give you an Idea:


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:

thm ov3rkill
- 23rd December 2008, 01:03
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

skimask
- 23rd December 2008, 02:19
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.

thm ov3rkill
- 23rd December 2008, 03:11
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.

hey ski mask thanks.. Ill keep that in mind I been reading 2 books already so yup.. Ill try to get this code to work one question was if the same pin can read the low coming from the trigger and rapidfire on the same pin..

Darrel Taylor
- 23rd December 2008, 04:17
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.

What's it going to take skimask?

People come here for help, and the purpose of this forum is to try to provide that.
Ridicule and belittling, are NOT part of the program.

If you have no help to offer, then you have no reason to post.
<br>

Archangel
- 23rd December 2008, 04:33
I thought you were trying to duplicate the the other guys chip, with separate mode and trigger inputs. And in your subroutines you can tell it to do what you want including sleep, then you have to figure out how to reawaken it with . . . an interrupt ? It is why I said at the beginning, buy the other guy's chip and then work on your own too, he put a lot of effort into that including storing the on/off status in eprom. If you are as new as you appear, you are looking @ 2 years to success, a little less if you are young. That said, none of are getting any younger, so post the code you PMed me and let's have at it!

skimask
- 23rd December 2008, 04:56
What's it going to take skimask?

People come here for help, and the purpose of this forum is to try to provide that.
Ridicule and belittling, are NOT part of the program.

If you have no help to offer, then you have no reason to post.
<br>

I think I've got a pretty good template for him to work from, complete and everything, never thought it was worth anything since I've seen the same type of thing all over the internet.
BUT, I'VE ALREADY BUILT A COUPLE OF THEM FOR A FRIEND AS A BIRTHDAY PRESENT ABOUT A YEAR AGO! NOT QUITE THE SAME, SINGLE-SHOT, 5 SHOT, CONTINUOUS, OFF, AND...NOT ONLY THAT, BUT EVENTUALLY, ONCE I SAW THAT THE GUY WAS ACTUALLY WORKING TOWARDS LEARNING HOW PBP WORKS, I WOULD HAVE UPLOADED THE WHOLE SHEBANG, THE WHOLE LOT, SCHEMATICs FOR THE NEW AND THE OLD CONTROLLER, PBP SOURCE CODE FOR THE 12F683, HEX FILEs, AND MAYBE, JUST MAYBE, SINCE IT'S THE HOLIDAY SEASON AND ALL, I MIGHT HAVE SENT THE GUY A FINISHED, PROGRAMMED PIC AND A FEW PICTURES OF THE FINISHED PRODUCT.

But, you know what...(and sorry there 'thm ov3rkill', but you've got DT to thank for this), skip it. Not gonna do it.

Go ban yourself for awhile! Better yet...Put it to another vote like you did last year.

But I will give the original poster a suggestion on the one question...

Ill try to get this code to work one question was if the same pin can read the low coming from the trigger and rapidfire on the same pin..
With some creative hardware, you might be able to get away with it. You could leave the pin floating, use one switch to pull it low thru a high value resistor, use the other switch to pull it high thru another high value resistor. There's an app note around somewhere that describes how to do that sort of thing.
Another option is to plug the switches into an A/D input and use a couple of resistors as a voltage divider. One switch pulls the input down to, say 1v, the other switch pulls the input down to 2v, both switches 3v, or something to that effect.
But since you've got unused pins, easier just to read two pins with one switch each, than read two switches on one pin.

Darrel Taylor
- 23rd December 2008, 05:00
No vote required.

Thank you!

Darrel Taylor
- 23rd December 2008, 05:28
Sorry bout that!

Maybe now, Joe can't get something accomplished here.

I'll help if I can too.
Might want to start a new thread though. :o
<br>

Archangel
- 23rd December 2008, 06:20
Maybe now, Joe <font color=red>can't </font color>get something accomplished here.Freudian slip, or are you telling me something here ? :D

Darrel Taylor
- 23rd December 2008, 06:23
DOH!

That was supposed to be CAN.

Freud just might have a theory or two. :o

Sorry Joe!

Archangel
- 23rd December 2008, 06:31
DOH!

That was supposed to be CAN.

Freud just might have theory or two. :o

Sorry Joe!
No Problem ! Everyone's just too serious, I will be glad when 12/26 rolls about ! Anyway we'll whip up some tasty spaghetti, unless we get some experts to help, long as it works Hey!

Darrel Taylor
- 23rd December 2008, 07:00
I've been working on an NKK display in another thread for what seems like a week (3 days). So I hadn't been paying much attention to this one.

After a quick review, the problem I see is that there are a lot of buttons on the 360 controller. It's most likely that the buttons are "Multiplexed".

In the PDF of the original project, it shows an input FROM the button, and an output TO the button. So apparently the pulses can only be put out when that button gets scanned.

This will be more difficult than just toggling a pin 3 times.

Do you have an oscillicope to verify if they're scanned or not?
<br>

mackrackit
- 23rd December 2008, 12:39
No Problem ! Everyone's just too serious, I will be glad when 12/26 rolls about ! Anyway we'll whip up some tasty spaghetti, unless we get some experts to help, long as it works Hey!

Joe,
Do you have any good quotes from DicTators ?

thm ov3rkill
- 23rd December 2008, 14:53
I've been working on an NKK display in another thread for what seems like a week (3 days). So I hadn't been paying much attention to this one.

After a quick review, the problem I see is that there are a lot of buttons on the 360 controller. It's most likely that the buttons are "Multiplexed".

In the PDF of the original project, it shows an input FROM the button, and an output TO the button. So apparently the pulses can only be put out when that button gets scanned.

This will be more difficult than just toggling a pin 3 times.

Do you have an oscillicope to verify if they're scanned or not?
<br>


well those are not buttons the middle one is the one that acually bings the low to fire the trigger the others are inputs and outputs dont know whih ones ill do some more research thanks!

thm ov3rkill
- 23rd December 2008, 15:38
Hey after playing around and some testing with my new multimeter I found out this, The top pin is always low or ground the middle pin is 1.41 volt When the trigger is not held down, But when you start pressing the trigger it slowly starts decreasing, the more you hold it down the less the voltage gets. When i held the trigger down all the way It was at 0.31-0.30 volts thats afcourse when its down all the the way but even if you press it a little bit the voltage will decrease a little bit and the bottem pin of the 3 is at 1.61 volt all the time and doesent decrease nor increase. This is afcourse on this version of the controller while the other fires off high but not low like this
http://i159.photobucket.com/albums/t128/dan7123/untitled-4.jpg

RapidFireMods
- 27th December 2008, 19:59
this is cool