Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
GetADC problem

 
Post new topic   Reply to topic    Forum Index -> ZX-24
Author Message
manuelito80



Joined: 10 Mar 2006
Posts: 3

Posted: 27 March 2006, 18:19 PM    Post subject: GetADC problem Reply with quote

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: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZX-24 Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group