Acidmods

Console Modding------ ( Here you can talk about your favorite Consoles ) => Xbox One => Xbox One controllers/Xbox One Rapid fire Controllers => Topic started by: Aliamir on December 08, 2014, 07:09:34 PM

Title: Cannot Drive Trigger High
Post by: Aliamir on December 08, 2014, 07:09:34 PM
Hello Everyone!

I'm trying to write rapidfire code for the Xbox 1, and I'm a but confused. I'm followed SethMods advice he mentioned before:

while( trigger > .20V){  //Dwell until hall is being powered
wait 480uS;                   //to allow Vout to settle d
readRT();                       //Read and store RT voltage
    if( rt < setpoint ){
        //Execute RF by driving rt high or low for 600uS
       
    }
wait 5ms;                      //This puts us in the dead part of the frame about 2ms before the trigger is powered again

}   //Loop

The main problem I'm having is when the trigger is pulled (trigger voltage is 0V) I'm not able to drive the voltage up with the micro pin. I'm using a PIC16f.

Here is my code, I've steped through it multiple times, and tested each section. The main issue is when the trigger is fully depressed, I cannot get the pin to go high again with RC7. TriggerHandler() is called every 500us.

void TriggerHandler(void)
{
   static bool triggerPulled = false;
   static uint8_t triggerADC_Cnt = 0;
   static uint8_t cnt = 0;
   uint16_t triggerADC = 0;

   if (false == triggerPulled)
   {
      if (ADC_IsConversionDone())
      {
         triggerADC = ADC_GetConversionResult(); //get conversion
         ANSELC = 0x80; //set pin to ADC
         ADC_StartConversion(RT); //start new conversion
      }

      //check trigger ADC value if below 400
      if (triggerADC < TRIGGER_ADC_THRESHOLD) //threshold is 400 counts
      {
         triggerADC_Cnt++;
      }
      else
      {
         triggerADC_Cnt = 0;
      }

      //check if counter is above 18 loops
      if (triggerADC_Cnt >= TRIGGER_CNT_THRESHOLD) //threshold is 18 (18loops*500us = 9ms)
      {
         triggerPulled = true; //trigger has been pulled, set pin as an output and control rapid fire
         triggerADC_Cnt = 0;
      }
   }
   else //triggerPulled == true
   {
      if (ADC_IsConversionDone())
      {
         triggerADC = ADC_GetConversionResult(); //get conversion
         if (triggerADC > 180u)//around 0.6V
         {
            if (cnt < 9)
            {
               ANSELC &= ~0x80; //turn off adc on pin
               TRISC &= ~0x80; //make pin output
               LATB |= 0x80; //force it high
               cnt++;
            }
            else if (cnt < 18)
            {
               ANSELC &= ~0x80; //turn off adc on pin
               TRISC |= 0x80; //make pin output
               LATB &= ~0x80; //force it low
               cnt++;
            }
            else
            {
               cnt = 0;
               triggerPulled = false;
            }
         }
         ANSELC = 0x80; //set pin to ADC
         ADC_StartConversion(RT); //start new conversion
      }
   }
}

What I've also tried is replaced the inside of "else //triggerPulled == true" code to just pulse the pin HIGH and LOW every 40ms just to see if the trigger will change. I just can't get the pin to go high again when the trigger is pressed. I CAN have firing occur when the trigger is released though, but that doesn't really help lol.

The way I have the micro wired is very simple: RC7 connected to RT. I got this from RDC's post:
https://www.acidmods.com/forum/index.php?topic=43204.0 (https://www.acidmods.com/forum/index.php?topic=43204.0)
Maybe this is the issue? Is it supposed to be wired differently?

I'd appreciate any help anyone can provide. This is just a hobby for me, but I'd love to have my own mod working :)

Thanks in advance!
Title: Re: Cannot Drive Trigger High
Post by: SethMods on December 09, 2014, 03:27:50 PM
Can you post a picture of where you are tying into the XB1 controller for RT? (The wire coming off of RC7, where is it soldered to?)
Title: Re: Cannot Drive Trigger High
Post by: Aliamir on December 09, 2014, 05:43:56 PM
Picture is here:

(https://acidmods.com/forum/proxy.php?request=http%3A%2F%2Fs28.postimg.org%2Fjvrd2gp49%2FIMG_20141209_203448.jpg&hash=da4182145b918125c879c7fe95132ed91a978ecf) (http://postimg.org/image/jvrd2gp49/)


Is that the right spot?
Title: Re: Cannot Drive Trigger High
Post by: SethMods on December 10, 2014, 08:01:13 AM
You need to be on the other side of that ?RC Filter?

So soldered to the same two components but on the left-hand side (based on your picture).

I had this exact same problem when I started. Move that point, and you should be fine.
Title: Re: Cannot Drive Trigger High
Post by: Aliamir on December 10, 2014, 08:09:35 AM
Thanks for the help!
Do you have a picture, just so I'm sure to solder to the right spot? A picture where to solder for LT and RT would be extremely helpful just so I know for sure I'm doing it right.

Thanks again!
-Aliamir
Title: Re: Cannot Drive Trigger High
Post by: RDC on December 10, 2014, 04:16:16 PM
There is only one other side of the Resistor that you've already soldered to. ;)
Title: Re: Cannot Drive Trigger High
Post by: Aliamir on December 10, 2014, 08:28:54 PM
I got a little confused by the "2 components part" that's why I was looking for some clarification. Thanks! I'll give it a try. :)
Title: Re: Cannot Drive Trigger High
Post by: Aliamir on December 11, 2014, 05:10:00 PM
I accidentally removed the resistor   :censored:. What is the value of that resistor so I can replace it?
Title: Re: Cannot Drive Trigger High
Post by: RDC on December 11, 2014, 06:20:58 PM
100ohm, 0402
SimplePortal 2.3.5 © 2008-2012, SimplePortal