|
|
| Author |
Message |
manuelito80
Joined: 10 Mar 2006
Posts: 3
|
|
Posted: 27 March 2006, 18:19 PM Post subject: GetADC problem |
|
|
Hi All.
I wrote a simple program that simply loop to verify the light intensity using the BX-24 Dev Station and a ZX-24
The problem is that the GetADC function doesn't return a number between 0 and 1023, but always great numbers such as A645F3 (hex format).
If I use a BX-24 with the same code everything works fine.
Here is the code:
| Code: |
const lightPin as byte = 20
Sub Main()
dim lightValue as integer
Call PutPin(lightPin, bxInputTristate)
Do
Call Delay(1.0)
Debug.Print CStr(GetADC(lightPin))
Call Delay(5.0)
Loop
End Sub
|
Any suggestion or is it a bug?
Thanks. |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 27 March 2006, 20:06 PM Post subject: |
|
|
| Quote: | | Any suggestion or is it a bug? |
The code that you provided seems to output good values on my test system, ranging from 0 to 1023 depending on how I vary the voltage at the test pin.
You might try this slight modification to the loop code to see if it makes any difference. Also, try a different ADC pin.
| Code: | Do
Dim ival as Integer
Call Delay(1.0)
ival = GetADC(lightPin)
Debug.Print CStr(ival)
Loop |
|
|
| Back to top |
|
 |
|