Discussion forum for the BasicX family of microcontroller chips.
|
Hi i was playing with the GetADC command, i used a loop to gather the voltage off of a pin, i think it is broken because the readings are always wrong. here is the code: -------- Do Voltage = GetADC(PinNumber) Debug.Print CStr(Voltage) Delay(0.50) Loop --------- I only get a value of 500 or so(usually around 500-600). My hardware setup, basically i just connected from pin 13(the pinnumber) to ground. Also without any wires connected to the BX, i tried all the other pin numbers and they all return the same wierdo random numbers. I think my BX is broken. does anyone know? I also tried putting this: "Call PutPin(13, bxInputTristate)" before the getadc call and this doesn't help. Somebody please help. Thanks __________________________________ |
|
|
|
Your code's good, as long as voltage is an integer, but your circuit is probably wrong. Use a voltage divider, with the middle attached to the pin. Or use a variable resistor attached to 5V and a pulldown resistor as well. On Monday, August 18, 2003, at 02:55 AM, Jack Wu wrote: > Hi i was playing with the GetADC command, i used a > loop to gather the voltage off of a pin, i think it is > broken because the readings are always wrong. here is > the code: > -------- > Do > Voltage = GetADC(PinNumber) > Debug.Print CStr(Voltage) > Delay(0.50) > Loop > --------- > I only get a value of 500 or so(usually around > 500-600). My hardware setup, basically i just > connected from pin 13(the pinnumber) to ground. Also > without any wires connected to the BX, i tried all the > other pin numbers and they all return the same wierdo > random numbers. I think my BX is broken. does anyone > know? -- Tom Igoe |
|
|
|
i attached the pins directly to the ground line, and i was still getting wacky readings. Then i just did a getpin and i got a "1" returned. That's wrong, it should be a "0". And this is with a bare bones BX with the pins tied to ground. This must be broken, or i have RF interference. --- Tom Igoe <> wrote: > > Your code's good, as long as voltage is an integer, > but your circuit is > probably wrong. Use a voltage divider, with the > middle attached to the > pin. Or use a variable resistor attached to 5V and > a pulldown resistor > as well. > On Monday, August 18, 2003, at 02:55 AM, Jack Wu > wrote: > > > Hi i was playing with the GetADC command, i used a > > loop to gather the voltage off of a pin, i think > it is > > broken because the readings are always wrong. > here is > > the code: > > -------- > > Do > > Voltage = GetADC(PinNumber) > > Debug.Print CStr(Voltage) > > Delay(0.50) > > Loop > > --------- > > I only get a value of 500 or so(usually around > > 500-600). My hardware setup, basically i just > > connected from pin 13(the pinnumber) to ground. > Also > > without any wires connected to the BX, i tried all > the > > other pin numbers and they all return the same > wierdo > > random numbers. I think my BX is broken. does > anyone > > know? > > > > > > -- > Tom Igoe __________________________________ |
|
|
|
On Monday, August 18, 2003, at 01:20 PM, Jack Wu wrote: > i attached the pins directly to the ground line, and i > was still getting wacky readings. Then i just did a > getpin and i got a "1" returned. That's wrong, it > should be a "0". And this is with a bare bones BX > with the pins tied to ground. This must be broken, or > i have RF interference. What happened when you tied it to 5V? Did you try the same thing on pin 14? I have seen people fry the first channel of the ADC frequently, especially when they put the chip in upside down the first time and try to power it. -- Tom Igoe |
|
|
|
With Getpin, it returns a 1 no matter what. in fact it was being kinda iffy now. It would display 0 for a few iterations in a loop, and then switch over to being 1. My BX has worked fine for over a year, now it's kinda messed up. For example when i try and read AD with GETADC, it will read a few iterations in a loop and then freeze. --- Tom Igoe <> wrote: > > On Monday, August 18, 2003, at 01:20 PM, Jack Wu > wrote: > > > i attached the pins directly to the ground line, > and i > > was still getting wacky readings. Then i just did > a > > getpin and i got a "1" returned. That's wrong, it > > should be a "0". And this is with a bare bones BX > > with the pins tied to ground. This must be > broken, or > > i have RF interference. > What happened when you tied it to 5V? Did you try > the same thing on > pin 14? I have seen people fry the first channel of > the ADC > frequently, especially when they put the chip in > upside down the first > time and try to power it. > -- > Tom Igoe __________________________________ |