• AVR Freaks

Hot!ADC help

Page: < 123 Showing page 3 of 3
Author
ric
Super Member
  • Total Posts : 29496
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: ADC help 2020/12/02 01:28:34 (permalink)
0 (2)
What were the two voltages you measure (off and on) with it connected either way?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#41
CptChronic
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/11/20 20:58:44
  • Location: 0
  • Status: offline
Re: ADC help 2020/12/02 02:48:16 (permalink)
-1 (1)
Two voltages from where?
The chip is powered with 3.3v from both the controller and pickit (pickit is removed when testing the controller)
The controller is powered by 2x AA batteries.
The trigger when not pulled its voltage is 0.11v
The trigger pulled fully its voltage is 0.1v
 
So i have everything setup on a breadboard. The chip is in place (16f18325) and connected to my computer via a pickit4.
The trigger (RT) from the controller is connected to RA0 or ANA0 as its analog.
I have ran a couple of wires from vss and vdd so i can connect my multimeter
 
------------------------------------------------------------------------------
When the chip is powered from the pickit (controller removed)
When connected between vdd and vss, the multimeter reads:
voltage is 3.25v
When a 10k resistor is placed between vdd, voltage is 3.20v
When a 10k resistor is placed between vss, voltage is 3.21v
------------------------------------------------------------------------------
When the chip is powered from the controller (pickit removed)
When connected between vdd and vss, the multimeter reads:
voltage is 3.31v
When a 10k resistor is placed between vdd, voltage is 3.26 v
When a 10k resistor is placed between vss, voltage is 3.27v
------------------------------------------------------------------------------
 
#42
ric
Super Member
  • Total Posts : 29496
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: ADC help 2020/12/02 03:08:09 (permalink)
+1 (3)
"Two voltages from where?"
The "two voltages" are those you measure when the trigger is pulled, and when it is not pulled.
 
I'm confused by your terminology.
When you say the resistor is "placed between vdd", do you mean connecting your signal and vdd?
That is how a "pullup" is connected.
Maybe a drawing of your schematic would be plainer.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#43
CptChronic
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/11/20 20:58:44
  • Location: 0
  • Status: offline
Re: ADC help 2020/12/02 03:55:12 (permalink)
0
When i say the resistor is "placed between vdd"
I mean i basically split the wire that comes from the vdd point and measure the voltage inbetween. So the vdd wire would normally go straight from the chip to the 3.3v point on the controllers pcb. I split that wire and put my multimeter either side so the wire goes from the chip, into my multimeter then out the other side to the 3.3v power point. I take it thats not right?
 
Am i ment to have the resistor placed on vdd and the trigger? and when i take a reading i have one part of the multimeter connected to the trigger and the other to vdd, then take a reading with the trigger not pressed and a reading with it pressed?
 
I am sorry, i know im being a pain. Ill try and get a schematic together
 
 
#44
ric
Super Member
  • Total Posts : 29496
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: ADC help 2020/12/02 04:07:48 (permalink)
0 (2)
The resistor should have one end connected to VDD, and the other end connected to your signal.
That is how a "pull up" is always connected.
The meter should have the negative lead connected to VDD (ground), and the positive lead connected to your trigger signal.
Unless otherwise specified, voltages should always be measured with the negative lead connected to ground.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#45
CptChronic
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/11/20 20:58:44
  • Location: 0
  • Status: offline
Re: ADC help 2020/12/02 04:11:31 (permalink)
0
Ah thats what i did to start with, this is the reading i get when the multimeter is connected on the pcb to ground and the trigger.
 
The trigger when not pulled its voltage is 0.11v
The trigger pulled fully its voltage is 0.1v
#46
CptChronic
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/11/20 20:58:44
  • Location: 0
  • Status: offline
Re: ADC help 2020/12/02 04:22:35 (permalink)
0
Regarding the schematic, the points on the microchip go straight to the points on the pcb, they would be wired in place. At the moment im using a breadboard so i can quickly flip between having the pickit connected and disconnecting the controller when programming the chip.
 
VDD - Earth
VSS - 3.3v power source
RA0 - Trigger
RA5 - LED
#47
ric
Super Member
  • Total Posts : 29496
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: ADC help 2020/12/02 04:31:30 (permalink)
-1 (1)
CptChronic
The trigger when not pulled its voltage is 0.11v
The trigger pulled fully its voltage is 0.1v

Even when you connect the 10k resistor from trigger to Vdd ?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#48
CptChronic
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/11/20 20:58:44
  • Location: 0
  • Status: offline
Re: ADC help 2020/12/02 04:37:07 (permalink)
0 (2)
That bumps it up to 0.37v when not pressed, 0.26v when pressed.
#49
1and0
Access is Denied
  • Total Posts : 11775
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: ADC help 2020/12/02 05:35:38 (permalink)
+1 (3)
CptChronic
Regarding the schematic, ...
 
VDD - Earth
VSS - 3.3v power source

Reverse them. ;)
#50
davea
Super Member
  • Total Posts : 589
  • Reward points : 0
  • Joined: 2016/01/28 13:12:13
  • Location: Tampa Bay FL USA
  • Status: offline
Re: ADC help 2020/12/02 12:03:58 (permalink)
0
the battery voltage is 3v
the battery's are dead at 2.1 volts 
thay may be poling the the trigger to save battery life
do you have a scope to check it
but with pullup you should be ok
is VDD connected directly to controller Batt + ?
is VSS connected directly to controller Batt - ? 
please show you schematic
there is no reason you should not be able to have the controller
and pickit connected at the same time
 
#51
CptChronic
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/11/20 20:58:44
  • Location: 0
  • Status: offline
Re: ADC help 2020/12/04 04:29:31 (permalink)
0
The Halls are only powered up for a few milliseconds at a time.
VDD is connected to a 3.3v TP point.
VSS is connected to an earth on the thumbstick.
 
Do you want the controllers schematic? Or how i have wired from the pickit into the controller? I can only find one schematic for the controller and it only covers one pcb, theres two. RT and earth is connected to one, LED and power is connected to the other.
 
I am powering the chip with 3.3v from the pickit so when the contorller is connected too via batteries, it throws everything off. If i dont power the chip via the pickit, it doesnt program and tells me i need to use the pickit as a power source.
 
As the halls are only powered up for a few milliseconds, i have rewritten my code slightly.
 

void main(void)
{
    // initialize the device
    SYSTEM_Initialize();
    ADC_Initialize();
    ADC_SelectChannel(RT);
  
    while (1)
    {
        ADC_StartConversion();
   
    while (ADC_GetConversion(RT) < 300)
    {
        __delay_us(480);  // wait for voltage to settle
    }
        if (ADC_GetConversion(RT) < 300)
              
        {
        LATA = 0;
        LATA5 = 0;
        TRISA5 = 0;
        __delay_ms(500);
        TRISA5 = 1;
        __delay_us(600);
         }
    }
}

 
Again though, this: if (ADC_GetConversion(RT) < 300)
Gives the same result as this: if (ADC_GetConversion(RT) > 300)
The led flashes all the time until i pull the trigger in a certain amount (the same amount wether its < or >), i want it to do the opposite but changing < to > gives the exact same result. Which correct me if im wrong is very strange as < is saying if ADC count is below 300 and > is saying if ADC count is above 300. How can that give the same result?
 
I feel what im trying to do is quite simple but the ADC isnt working as it should. The coding is right its just the outcome is the opposite way round and when i flip the ADC < to > it doesnt change the result for some reason.
#52
davea
Super Member
  • Total Posts : 589
  • Reward points : 0
  • Joined: 2016/01/28 13:12:13
  • Location: Tampa Bay FL USA
  • Status: offline
Re: ADC help 2020/12/04 10:58:08 (permalink)
0
so you have a scope what are the voltages with trigerer pulled in
scope referenced to batt- directly (as using a strip alum foil strip between batt and spring) as GND
and check sensor GND signal and sensor out signal with scope
as the GND side of the sensor could be where the poling is done to reduce the number of ADC in the controler
 
 
#53
Page: < 123 Showing page 3 of 3
Jump to:
© 2021 APG vNext Commercial Version 4.5