Xref: utzoo comp.sys.amiga.programmer:4386 comp.sys.amiga.hardware:10054 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!unido!rwthinf!messua!marvin From: marvin@messua.informatik.rwth-aachen.de (Andreas Schneider) Newsgroups: comp.sys.amiga.programmer,comp.sys.amiga.hardware Subject: Re: I *STILL* need help with the POTGO resource! Message-ID: Date: 10 Jun 91 17:42:47 GMT References: <-J#-M6C@engin.umich.edu> Sender: news@rwthinf.UUCP Followup-To: comp.sys.amiga.programmer Lines: 73 chymes@uri.csmil.umich.edu (Charles Hymes) writes: >I use basically the following lines to set up the POTGO resource. ... >I tried other code as well, but the values at pot1dat never change no >matter what I do at the gameport. If I connect pins 5 or 9 to (the X >and Y pot pins) to pins 7 or 8 (+5 volts and Ground respectively) >Nothing changes at pot1dat. >Potinp changes the way you would expect it to, but I don't want on/off >values, I want the 8-bit values one expects from the Pots. >So whats the deal??!!!? >Charlweed Hymerfan I mailed this to you, but it seems you didn't get it. As other people might also be interested in this: I post it. A Modula-2 program I wrote reads the pots connected to the Amiga's gameport and it works. I don't speak the language too well, but this is how it should work in C: 1. Open Potgo-Resource PotgoADR=OpenResource(ResName,Version) where: Node *PotgoADR (adress of resource) char *ResName (Pointer to string : "potgo.resource") ULONG Version (use 0 to accept all versions) (Make sure PotgoADR !=0) 2. Tell resource which bits you need: BitsWanted=(DATRY|DATRX|START) BitsGot=AllocPotBits(BitsWanted) (Make sure that BitsWanted==BitsGot) 3. Tell resource to start measuring pots: WritePotgo(BitsGot,BitsGot) (in this case: start for Datrx and Datry) 4. Wait. This is very important because measuring the pots takes some time. You'll get wrong (too small) or no results if you don't wait. There are several ways to wait: - Start measuring at vertical blank and read results next vertical blank. - Delay(1) - Do something else that lasts as long as the time between two vertical blanks. 5. Finally: read result: result=(pot1dat) this gives you 2 bytes of information: one for each pot. 6. Continue with 3. (if you need more results). This worked for me and I think it should work for you (in C) If there are more questions about this: ask ! Bye Andreas