Das Open-Control-Projekt - Die Alternative zur C-Control-I


Das Forum zur C-Control-1
Welche C-Control-Varianten existieren?
Übersicht - Suchen - Neueste 50 Beiträge - Neuer Beitrag - Login - Registrieren
INFO - FAQ - CC2-Forum - CCPro-Forum 

 Re: Isn’t there a stabile program for ??? Kategorie: Programmierung Basic (von Hans - 6.03.2006 18:21)
 Als Antwort auf Re: Isn’t there a stabile program for ??? von Peter Grzeschik - 5.03.2006 19:53
Hans nutzt:  CC1-M-Unit V1.2/2.0
Thanks Peter

I wil try this version
But way is this program better??

Hans

> Hi Hans,
> try if this little program runs better on yours.
> I stored the references in a table.
> On hardware side I used 12 x 3K3 in the button-chain and 1 x 560K  from +5V to the AD-Port for recognizing if no key is pressed. By using other values for the resistors you may have to change the Values in the table.
> Note that there is only the PRINT command for result output in this example.
> I took the listing from an old application and it did run well as far as I remember.
>
> Best regards, Peter
>
>
>
>
> ' --- Definitions --------------------
>
> define Analog         AD[8] ' Inputport
> define Eingabe     byte[1] ' Input
> define Vergleich   byte[2] ' reference
> define Taste        byte[3] ' Button
> define Alt            byte[4] ' Old Value
> define N              byte[5] ' Counter
>
> ' --- Program Operationen ------
>
> Alt = 0: Taste = 0
>
> #Loop
>  Taste = 0
>  Eingabe = Analog
>  for N = 0 to 11
>   looktab Spannungen, N, Vergleich
>   if abs(Eingabe-Vergleich)<3 then Taste=N+1
>  next
>
>  if Taste = Alt then goto Loop
>  Alt = Taste
>  if Taste = 0 then goto Loop
>  print Taste-1
> goto Loop
>
> table Spannungen
>   152 173 90 0 193
>   111 23 214 132 46
>   68 235
> tabend

 Antwort schreiben

Bisherige Antworten: