Author Topic: Cannot Drive Trigger High  (Read 5771 times)

Offline Aliamir

  • MFH
  • Chief squatting Hard
  • *
  • Posts: 17
  • Post quality +0/-0
  • Gender: Male
  • arsenalmod.com
    • Arsenal Mod
Cannot Drive Trigger High
« 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
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!
Xbox Controller Mods - Engineered in the Arsenal of Democracy.
arsenalmod.com

Offline SethMods

  • Registered BST
  • King of the Wii-tards
  • *
  • Posts: 189
  • Post quality +17/-1
  • Gender: Male
  • Acidmods User
Re: Cannot Drive Trigger High
« Reply #1 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?)

Offline Aliamir

  • MFH
  • Chief squatting Hard
  • *
  • Posts: 17
  • Post quality +0/-0
  • Gender: Male
  • arsenalmod.com
    • Arsenal Mod
Re: Cannot Drive Trigger High
« Reply #2 on: December 09, 2014, 05:43:56 PM »
Picture is here:




Is that the right spot?
Xbox Controller Mods - Engineered in the Arsenal of Democracy.
arsenalmod.com

Offline SethMods

  • Registered BST
  • King of the Wii-tards
  • *
  • Posts: 189
  • Post quality +17/-1
  • Gender: Male
  • Acidmods User
Re: Cannot Drive Trigger High
« Reply #3 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.

Offline Aliamir

  • MFH
  • Chief squatting Hard
  • *
  • Posts: 17
  • Post quality +0/-0
  • Gender: Male
  • arsenalmod.com
    • Arsenal Mod
Re: Cannot Drive Trigger High
« Reply #4 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
Xbox Controller Mods - Engineered in the Arsenal of Democracy.
arsenalmod.com

Offline RDC

  • Administrator
  • Around the block
  • *
  • Posts: 2585
  • Post quality +90/-2
  • Gender: Male
  • The CGnome Project
Re: Cannot Drive Trigger High
« Reply #5 on: December 10, 2014, 04:16:16 PM »
There is only one other side of the Resistor that you've already soldered to. ;)
Screwing up is one of the best learning tools, so long as the only thing you're not learning is how to screw up.

Offline Aliamir

  • MFH
  • Chief squatting Hard
  • *
  • Posts: 17
  • Post quality +0/-0
  • Gender: Male
  • arsenalmod.com
    • Arsenal Mod
Re: Cannot Drive Trigger High
« Reply #6 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. :)
Xbox Controller Mods - Engineered in the Arsenal of Democracy.
arsenalmod.com

Offline Aliamir

  • MFH
  • Chief squatting Hard
  • *
  • Posts: 17
  • Post quality +0/-0
  • Gender: Male
  • arsenalmod.com
    • Arsenal Mod
Re: Cannot Drive Trigger High
« Reply #7 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?
Xbox Controller Mods - Engineered in the Arsenal of Democracy.
arsenalmod.com

Offline RDC

  • Administrator
  • Around the block
  • *
  • Posts: 2585
  • Post quality +90/-2
  • Gender: Male
  • The CGnome Project
Re: Cannot Drive Trigger High
« Reply #8 on: December 11, 2014, 06:20:58 PM »
100ohm, 0402
Screwing up is one of the best learning tools, so long as the only thing you're not learning is how to screw up.

 

SMF spam blocked by CleanTalk
SimplePortal 2.3.5 © 2008-2012, SimplePortal