Please help support the site by donating at the link below.https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8ZRU34U47BESW
;**********************************************************************; XBOX360 Rapidfire Project *; on the PICmicro PIC12F683. This file contains the basic code *; building blocks to build upon. *;**********************************************************************; *; Filename: xxx.asm *; Date: Now *; File Version: *; *; Author: Hazer *; Company: *; *; Modified by Alex *; Company: Modztronix *; *;********************************************************************** list p=12F683 ; list directive to define processor #include <p12F683.inc> ; processor specific variable definitions errorlevel -302 ; suppress message 302 from list file __CONFIG _FCMEN_OFF & _IESO_OFF & _CP_OFF & _CPD_OFF & _BOD_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTOSCIO ;EASY AND FAST MODE SETTING!!!;Below you can change quantity of the modes up to 10 modes,Speed and type of mode.;If you choose STATUSMODE different than 4 (Burst) then BURSTNUMBER will be ignored;DON'T DELETE POINTS BEFORE THE NUMBERS!!!;----------Speed and Mode settings-------------------------------------------------------------------------LEDSPEED equ .18 ;Speed of the LED flashing to show Modes ;(lower numbers faster flashing)(max 255) ; ;Current setting 18 ;To make for example 15 - write .15;----------------------------------------------------------------------------------------------------------TOTALMODES equ .8+.1 ;Total quantity of Modes which you want to create ; ;Current setting 8 Modes (max 10) ;To make for example 5 modes write .5+.1;----------------------------------------------------------------------------------------------------------FIRERATE1 equ .1000/(.8*.2) ;8spsSTATUSMODE1 equ .1 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER1 equ .2 ;Choose burst number ; ;Current setting 8sps and Normal Rapid Fire ;To make for example 16sps write .1000/(.16*.2);----------------------------------------------------------------------------------------------------------FIRERATE2 equ .1000/(.16*.2) ;16spsSTATUSMODE2 equ .1 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER2 equ .2 ;Choose burst number ; ;Current setting 16sps and Normal Rapid Fire;----------------------------------------------------------------------------------------------------------FIRERATE3 equ .1000/(.24*.2) ;24spsSTATUSMODE3 equ .1 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER3 equ .2 ;Choose burst number ; ;Current setting 24sps and Normal Rapid Fire;----------------------------------------------------------------------------------------------------------FIRERATE4 equ .1000/(.10*.2) ;10spsSTATUSMODE4 equ .2 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER4 equ .2 ;Choose burst number ; ;Current setting 10sps and COD5 Rapid Fire ;Max speed for COD5 is 10sps. Don't use higher speed;----------------------------------------------------------------------------------------------------------FIRERATE5 equ .1000/(.8*.2) ;8spsSTATUSMODE5 equ .3 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER5 equ .2 ;Choose burst number ; ;Current setting 8sps and Dual;----------------------------------------------------------------------------------------------------------FIRERATE6 equ .1000/(.16*.2) ;16spsSTATUSMODE6 equ .3 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER6 equ .2 ;Choose burst number ; ;Current setting 16sps and Dual;----------------------------------------------------------------------------------------------------------FIRERATE7 equ .1000/(.8*.2) ;8spsSTATUSMODE7 equ .4 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER7 equ .3 ;Choose burst number ; ;Current setting 8sps and Burst 3;----------------------------------------------------------------------------------------------------------FIRERATE8 equ .1000/(.8*.2) ;8spsSTATUSMODE8 equ .4 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER8 equ .5 ;Choose burst number ; ;Current setting 8sps and Burst 5;----------------------------------------------------------------------------------------------------------FIRERATE9 equ .1000/(.4*.2) ;4spsSTATUSMODE9 equ .1 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER9 equ .2 ;Choose burst number ; ;Current setting 4sps and Normal Rapid Fire;----------------------------------------------------------------------------------------------------------FIRERATE10 equ .1000/(.4*.2) ;4spsSTATUSMODE10 equ .1 ;1-Normal Rapid Fire, 2-COD5 Mode, 3-Dual, 4-BurstBURSTNUMBER10 equ .2 ;Choose burst number ; ;Current setting 4sps and Normal Rapid Fire;----------------------------------------------------------------------------------------------------------;***** VARIABLE DEFINITIONS******************w_temp EQU 0x70 ; variable used for context saving status_temp EQU 0x71 ; variable used for context savingFLAGS EQU 0x20 ;software state registerPULSER EQU 0x21 ;pulse on counterDWELLTIMER EQU 0x22 ;pulse off counterSTATER EQU 0x23 ;programmed stateSTATEL EQU 0x24FREQR EQU 0x25 ;frequency valueTEMP1 EQU 0x26TEMP2 EQU 0x27PULSEL EQU 0x28DWELLTIMEL EQU 0x29FREQL EQU 0x2ALEDBLINK EQU 0x2BTEMP3 EQU 0x2CBURSTRATE EQU 0x3EBURST10 EQU 0x3FFLAGS2 equ 0x41SHADOWP equ 0x42STATER_LOOP equ 0x43STATUSMODE equ 0x44;*******bits in FLAGS register***********PULSEONR equ 0PULSEONL equ 1LEDON equ 2TRIGOUT equ 3DUALMODE equ 4BURSTACTIVE equ 6COD5MODE equ 7;******bits in FLAGS2 registerBDWELL equ 0BDWELL2 equ 1BURSTONR equ 2BURSTONL equ 3;*********GPIO pin names*****************LEDR equ 5PROGSTATE equ 4BUTTON1 equ 2CONTROLTYPE equ 3TRIGGERR equ 0TRIGGERL equ 1;********************************************************************** ORG 0x000 ; processor reset vector goto main ; go to beginning of program ORG 0x004 ; interrupt vector location movwf w_temp ; save off current W register contents movf STATUS,w ; move status register into W register movwf status_temp ; save off contents of STATUS register ;Take a good note here. OSC is left at default 4MHz. ; We are running at 1MHz instruction cycle, or 1 micro second ;Timer 2 is prescaled 1:4 and compared (PR2) to 250. ; we now have hardware interupt that falls every 1ms exactly ;within limitation of osctune. Main code is inconsequential. ;PULSE and DWELL values control the signals precisely. ;All pulse logic is switched within the few microseconds to ;service the interupt routine. DO NOT modify the ISR ;with any kind of 'wait' or 'loop'. If you want to trigger ; timed events do so by setting an open FLAG bit and have the ;event done in the main loop. btfss PIR1, TMR2IF ;timer 2 int happened retfie;**************** LED blinking ********************************************* ;Our main routine will turn the flag bit ;LEDON on or off. The 10ms pulse is a duty cycle ;for the code to work with both CG and ;matrix controllers. btfsc FLAGS, LEDON ;LED off goto BlinkLed bsf STATUS, RP0 ;bank 1 bsf TRISIO, LEDR ;tristate LED bcf STATUS, RP0 ;bank 0 goto RightTrigger BlinkLed bsf STATUS, RP0 ;bank 1 bcf TRISIO, LEDR ;turn output on bcf STATUS, RP0 ;bank 0 btfss SHADOWP, LEDR goto LedLow decfsz LEDBLINK, f ;if pulse is active, count down 10ms goto RightTrigger bcf SHADOWP, LEDR movlw 0x0A movwf LEDBLINKLedLow decfsz LEDBLINK, f ;if pulse is active, count down 10ms goto RightTrigger bsf SHADOWP, LEDR movlw 0x0A movwf LEDBLINK;**************** Right trigger logic*************************************** RightTrigger movf STATER, f ;this will trigger the zero flag btfss STATUS, Z ;if STATER is zero, output is off. goto ActiveR bsf STATUS, RP0 ;bank 1 bsf TRISIO, TRIGGERR bsf TRISIO, TRIGGERL bcf STATUS, RP0 ;bank 0 goto EndInteruptActiveR btfss FLAGS, TRIGOUT bcf SHADOWP, TRIGGERR btfsc FLAGS, TRIGOUT bsf SHADOWP, TRIGGERR btfsc FLAGS, BURSTACTIVE goto BurstfireR btfss FLAGS, PULSEONR ;is pulse active? goto OffstateR decfsz PULSER, f ;if pulse is active, count down 10ms goto ActiveL bcf FLAGS, PULSEONR ;10ms is over, clear flags and output bsf STATUS, RP0 ;bank 1 bsf TRISIO, TRIGGERR ;and reset pulse time. bcf STATUS, RP0 ;bank 0 movf FREQR, w movwf PULSER btfss FLAGS, COD5MODE ;test COD5 mode goto ActiveL bcf STATUS, C rrf PULSER, f ;25% DUTYCYCLE for COD5 release goto ActiveLOffstateR decfsz DWELLTIMER, f ;count down dwell time to next pulse goto ActiveL bsf FLAGS, PULSEONR ;if dwell is done turn on outputs bsf STATUS, RP0 ;bank 1 bcf TRISIO, TRIGGERR ;and reset pulse time bcf STATUS, RP0 ;bank 0 movf FREQR, w ;from frequency value movwf DWELLTIMER btfss FLAGS, COD5MODE ;test COD5 model goto ActiveL bcf STATUS, C rrf DWELLTIMER, f addwf DWELLTIMER, f ;75% dutycycle for pull goto ActiveLBurstfireR btfss FLAGS2, BURSTONR goto ActiveL btfsc FLAGS2, BDWELL ;burst fire goto BurstDwellR btfss FLAGS, PULSEONR ;is pulse active? goto OffstateR2 decfsz PULSER, f ;if pulse is active, count down 10ms goto ActiveL bcf FLAGS, PULSEONR ;10ms is over, clear flags and output bsf STATUS, RP0 ;bank 1 bsf TRISIO, TRIGGERR ;and reset pulse time. bcf STATUS, RP0 ;bank 0 movf FREQR, w movwf PULSER btfsc FLAGS, COD5MODE ;test COD5 mode rrf PULSER, f decfsz BURST10, f goto ActiveL movf BURSTRATE, w movwf BURST10 bsf FLAGS2, BDWELL movf FREQR, w movwf DWELLTIMER btfss FLAGS, COD5MODE ;test COD5 mode goto ActiveL rrf DWELLTIMER, f addwf DWELLTIMER, f goto ActiveLOffstateR2 decfsz DWELLTIMER, f ;count down dwell time to next pulse goto ActiveL bsf FLAGS, PULSEONR ;if dwell is done turn on outputs bsf STATUS, RP0 ;bank 1 bcf TRISIO, TRIGGERR ;and reset pulse time bcf STATUS, RP0 ;bank 0 movf FREQR, w ;from frequency value movwf DWELLTIMER btfss FLAGS, COD5MODE ;test COD5 mode goto ActiveL rrf DWELLTIMER, f addwf DWELLTIMER, f goto ActiveLBurstDwellR btfss FLAGS, TRIGOUT goto CGBurst btfss GPIO, TRIGGERR goto ActiveL goto BurstResetCGBurst btfsc GPIO, TRIGGERR goto ActiveLBurstReset bcf FLAGS, PULSEONR ;if dwell is done turn on outputs bcf FLAGS2, BDWELL bcf FLAGS2, BURSTONRActiveL btfsc FLAGS, DUALMODE ;Check if Dual Mode goto Continue02 bsf STATUS, RP0 ;bank 1 bsf TRISIO, TRIGGERL bcf STATUS, RP0 ;bank 0 goto EndInterupt Continue02 btfss FLAGS, TRIGOUT bcf SHADOWP, TRIGGERL btfsc FLAGS, TRIGOUT bsf SHADOWP, TRIGGERL btfss FLAGS, PULSEONL ;is pulse active? goto OffstateL decfsz PULSEL, f ;if pulse is active, count down 10ms goto EndInterupt bcf FLAGS, PULSEONL ;10ms is over, clear flags and output bsf STATUS, RP0 ;bank 1 bsf TRISIO, TRIGGERL ;and reset pulse time bcf STATUS, RP0 ;bank 0 movf FREQR, w movwf PULSEL goto EndInteruptOffstateL decfsz DWELLTIMEL, f ;count down dwell time to next pulse goto EndInterupt bsf FLAGS, PULSEONL ;if dwell is done turn on outputs bsf STATUS, RP0 ;bank 1 bcf TRISIO, TRIGGERL ;and reset pulse time bcf STATUS, RP0 ;bank 0 movf FREQR, w ;from frequency value movwf DWELLTIMELEndInterupt bcf PIR1, TMR2IF movf SHADOWP, w movwf GPIO movf status_temp,w ; retrieve copy of STATUS register movwf STATUS ; restore pre-isr STATUS register contents swapf w_temp,f swapf w_temp,w ; restore pre-isr W register contents retfie ; return from interrupt;*************************************SUBROUTINES**********************************Wait10ms clrf TEMP2 movlw 0x0D movwf TEMP1 ;rough 10ms timer for button debounce.Loop1 decfsz TEMP2, f ;count down 256*3=768 cycles goto Loop1 decfsz TEMP1, f ;count down 768*13=9986 cycles goto Loop1 return ;*************************************************************ReadEE bsf STATUS , RP0 ;Bank1 movlw 0x04 movwf EEADR bsf EECON1 , RD ;start read movf EEDAT , W bcf STATUS , RP0 ;Bank0 return ;*************************************************************WriteEE bsf STATUS , RP0 movwf EEDAT movlw 0x04 movwf EEADR bsf EECON1,WREN ;Enable write bcf INTCON, GIE ;Disable INTs btfsc INTCON, GIE ;See AN576 goto $-2 movlw 0x55 ;Unlock write movwf EECON2 movlw 0xAA movwf EECON2 bsf EECON1, WR ;Start the writeWaitForEEWrite btfsc EECON1, WR ;wait for hardware to clear (done writing) goto WaitForEEWrite bcf STATUS , RP0 ;Bank0 bsf INTCON, GIE ;Enable INTS return;*******************Burst fire test*******************************BursttestCG btfss FLAGS, BURSTACTIVE ;is burst active? return btfsc GPIO, TRIGGERR ;is trigger pulled on CG? bsf FLAGS2, BURSTONR ;activate burstfire returnBursttestMX btfss FLAGS, BURSTACTIVE ;is burst active? return btfss GPIO, TRIGGERR ;is trigger pulled on MX? bsf FLAGS2, BURSTONR ;activate burstfire return;**********************************************************************************;**********************************************************************************;**********************************************************************************main clrf GPIO clrf FLAGS clrf FLAGS2 movlw 0x07 movwf CMCON0 ;comparators off bsf STATUS, RP0 ;bank 1 movlw 0x1C movwf TRISIO ;pin 0 & 1 & 5 out, all other inputs clrf ANSEL ;all digital pins movlw 0x14 movwf WPU ;enable week pullups bcf OPTION_REG, 7 ;enable all week pullups bcf STATUS, RP0 ;bank 0 movlw 0x01 movwf T2CON ;timer 2, prescale 1:4, no postscale bsf STATUS, RP0 ;bank 1 movlw 0xFA movwf PR2 ;setup 1ms hardware interupt bsf PIE1, TMR2IE ;enable timer2 interupt bcf STATUS, RP0 ;bank 0 bsf T2CON, TMR2ON ;turn on timer2 movlw 0xC0 movwf INTCON ;turn on interupts globally movlw 0x30 ;start with 10ms pulse width movwf LEDBLINK movlw FIRERATE3 ; movwf PULSER movwf PULSEL movwf DWELLTIMER movwf DWELLTIMEL movlw 0x05 movwf BURSTRATE movwf BURST10 btfsc GPIO, CONTROLTYPE ;if pin 4 is pulled lo bsf FLAGS, TRIGOUT ;leave output lo; call ReadEE ;get state value; movwf STATER; movf STATER, f clrf STATER ;start in off mode.; btfss STATUS, Z; bsf FLAGS, LEDON ;get LED status ;******MAIN LOOP***************Start btfss FLAGS, TRIGOUT call BursttestCG btfsc FLAGS, TRIGOUT call BursttestMX btfsc GPIO, PROGSTATE goto Start ;wait for the fun to begin call Wait10ms btfsc GPIO, PROGSTATE ;button is down for 10ms goto StartRelease btfss GPIO, PROGSTATE ;wait for button release goto Release call Wait10ms btfss GPIO, PROGSTATE ;wait for button release goto Release;#######################################; incf STATER,f ; movlw TOTALMODES ; xorwf STATER,w ; btfsc STATUS,Z ; clrf STATER ;;---------------------------------------; movf STATER, w ; call WriteEE ;store state;---------------------------------------;Do_Mode0 ; movlw .0 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode1 ; ; movlw FIRERATE1 ;No Rapid Fire movwf FREQR ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst bcf FLAGS, LEDON ;turn off LED goto Start ;;---------------------------------------;;---------------------------------------;Do_Mode1 ;MODE 1 movlw .1 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode2 ; ; bsf FLAGS, LEDON ;turn ON LED movlw FIRERATE1 ;No Rapid Fire movwf FREQR ;D_M1_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE1 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M1_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto Start ;;```````````````````````````````````````;D_M1_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE1 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M1_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto Start ;;```````````````````````````````````````;D_M1_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE1 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M1_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto Start ;;```````````````````````````````````````;D_M1_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER1 ; movwf BURSTRATE ; movwf BURST10 ; goto Start ;;---------------------------------------;;---------------------------------------;Do_Mode2 ;MODE 2 movlw .2 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode3 ; ; movlw FIRERATE2 ;Rapid Fire movwf FREQR ;D_M2_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE2 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M2_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M2_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE2 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M2_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M2_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE2 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M2_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M2_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER2 ; movwf BURSTRATE ; movwf BURST10 ; goto LED_Flashing ;;---------------------------------------;;---------------------------------------;Do_Mode3 ;MODE 3 movlw .3 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode4 ; ; movlw FIRERATE3 ;Rapid Fire movwf FREQR ;D_M3_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE3 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M3_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M3_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE3 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M3_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M3_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE3 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M3_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M3_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER3 ; movwf BURSTRATE ; movwf BURST10 ; goto LED_Flashing ;;---------------------------------------;;---------------------------------------;Do_Mode4 ;MODE 4 movlw .4 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode5 ; ; movlw FIRERATE4 ;Rapid Fire movwf FREQR ;D_M4_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE4 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M4_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M4_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE4 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M4_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M4_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE4 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M4_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M4_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER4 ; movwf BURSTRATE ; movwf BURST10 ; goto LED_Flashing ;;---------------------------------------;;---------------------------------------;Do_Mode5 ;MODE 5 movlw .5 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode6 ; ; movlw FIRERATE5 ;Rapid Fire movwf FREQR ;D_M5_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE5 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M5_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M5_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE5 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M5_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M5_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE5 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M5_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M5_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER5 ; movwf BURSTRATE ; movwf BURST10 ; goto LED_Flashing ;;---------------------------------------;;---------------------------------------;Do_Mode6 ;MODE 6 movlw .6 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode7 ; ; movlw FIRERATE6 ;Rapid Fire movwf FREQR ;D_M6_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE6 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M6_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M6_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE6 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M6_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M6_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE6 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M6_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M6_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER6 ; movwf BURSTRATE ; movwf BURST10 ; goto LED_Flashing ;;---------------------------------------;;---------------------------------------;Do_Mode7 ;MODE 7 movlw .7 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode8 ; ; movlw FIRERATE7 ;Rapid Fire movwf FREQR ;D_M7_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE7 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M7_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M7_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE7 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M7_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M7_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE7 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M7_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M7_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER7 ; movwf BURSTRATE ; movwf BURST10 ; goto LED_Flashing ;;---------------------------------------;;---------------------------------------;Do_Mode8 ;MODE 8 movlw .8 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode9 ; ; movlw FIRERATE8 ;Rapid Fire movwf FREQR ;D_M8_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE8 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M8_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M8_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE8 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M8_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M8_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE8 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M8_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M8_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER8 ; movwf BURSTRATE ; movwf BURST10 ; goto LED_Flashing ;;---------------------------------------;;---------------------------------------;Do_Mode9 ;MODE 9 movlw .9 ; xorwf STATER,w ; btfss STATUS,Z ; goto Do_Mode10 ; ; movlw FIRERATE9 ;Rapid Fire movwf FREQR ;D_M9_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE9 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M9_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M9_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE9 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M9_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M9_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE9 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M9_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M9_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER9 ; movwf BURSTRATE ; movwf BURST10 ; goto LED_Flashing ;;---------------------------------------;;---------------------------------------;Do_Mode10 ;MODE 10 movlw FIRERATE10 ;Rapid Fire movwf FREQR ;D_M10_1 ; movlw .1 ; movwf STATUSMODE ; movlw STATUSMODE10 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M10_2 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M10_2 ; movlw .2 ; movwf STATUSMODE ; movlw STATUSMODE10 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M10_3 ; bsf FLAGS, COD5MODE ;Yes COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M10_3 ; movlw .3 ; movwf STATUSMODE ; movlw STATUSMODE10 ; xorwf STATUSMODE,w ; btfss STATUS,Z ; goto D_M10_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bsf FLAGS, DUALMODE ;Yes Dual Mode bcf FLAGS, BURSTACTIVE ;No Burst goto LED_Flashing ;;```````````````````````````````````````;D_M10_4 ; bcf FLAGS, COD5MODE ;No COD5 mode bcf FLAGS, DUALMODE ;No Dual Mode bsf FLAGS, BURSTACTIVE ;Yes Burst movlw BURSTNUMBER10 ; movwf BURSTRATE ; movwf BURST10 ; goto LED_Flashing ;;#######################################;;#######################################;LED_Flashing ; bsf STATUS, RP0 ;bank 1 bsf TRISIO, TRIGGERR ; bcf STATUS, RP0 ;bank 0 ; movfw STATER ; movwf STATER_LOOP ; ; movlw LEDSPEED ; movwf TEMP3 ;Loop01 ; btfss GPIO, PROGSTATE ;check the button goto Start ; call Wait10ms ; decfsz TEMP3, f ; goto Loop01 ; bsf FLAGS, LEDON ;turn on LED 1/4 sec ;Loop02_0 ; movlw LEDSPEED ; movwf TEMP3 ;Loop02 ; btfss GPIO, PROGSTATE ;check the button goto Start ; call Wait10ms ; decfsz TEMP3, f ; goto Loop02 ; bcf FLAGS, LEDON ;turn off LED 1/4 sec ; movlw LEDSPEED ; movwf TEMP3 ;Loop03 ; btfss GPIO, PROGSTATE ;check the button goto Start ; call Wait10ms ; decfsz TEMP3, f ; goto Loop03 ; bsf FLAGS, LEDON ;turn on LED ; decfsz STATER_LOOP,f ; goto Loop02_0 ; goto Start ;;#######################################; ; initialize eeprom locations ORG 0x2100 DE 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07 END ; directive 'end of program'
Hi!!!! I hope to help you.And I hope to shareThis is a small template.Just makes the Auto Active Perfect Reload function in two weapons.exactly what he said Modztronix :1. Write speed 2sps For example: FIRERATE1 equ 0x14 ; For Lancer RETROMode equ .4 ; 4-Burst to only make once, the recharge !!!!!!!!!!!!!!!!burstNumber equ .1 ;only a Puse RB button again For example: FIRERATE2 equ 0x11 ;For HammerburstMode equ .4 ; 4-Burst to only make once, the recharge !!!!!!!!!!!!!!!!burstNumber equ .1 ;only a Puse RB button again2. Find ***** VARIABLE DEFINITIONS******************After TEMP3 EQU 0x2C you need add INTSLOW EQU 0x2D3. Find **************** Right trigger logic********************* Add RightTrigger decfsz INTSLOW, f goto EndInterupt movlw .71 ; very very slow,,,, (to be able to recharge) movwf INTSLOW movf STATER, f ;this will trigger the zero flag btfss STATUS, Z ;if STATER is zero, output is off.**********************************************************************************;**********************************************************************************Solder Pin of RT in ( right pin of RB button);**********************************************************************************; That alone is not necessary to modify the (Main)Thank you, thank you very much Modztronix !!
dont worry i figured it out, to do 8.22 shots a second do i just write 8.22 as so far all the speeds are whole seconds?
yea i tried it, this code only allows whole seconds so you cant add the .22 i was after for it. also i have fitted this to a matrix 2 and when ever the controller vibrates the rf starts firing by itself and akimbo is a little crazy. if you disable the vibrate function in game then it works fine in every mode apart from akimbo still.
Topfire code has programmable mode for adjusting sps. I recommend the Rag from viking if you want an all in one chip for gears also. Matt is putting orders together for rags now.