## how to speed up this stack with an array

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

smokingwheels
Newbie
Posts: 3
Joined: Wed Dec 14, 2011 8:18 am

### how to speed up this stack with an array

The program loops around and stores a value say 60 times a second.
I built it to check the capas in my 37 year old Amplifier.
Code
........
c6=c5
c5=c4
c4=c3
c3=c2
c2=c1
c1=c

then on the timer I calculate the average but the numbers still go up and down.
eg c+c1+c2....../6
I also know the frequency of the loop so I would like to adjust the amount of records stored in the stack.

Here is what I have so far..

DEFLNG A-Z
REM capa program
CLS
TIMER ON
ON TIMER(1) GOSUB health

start:
OUT 956, 255
DO: t = t + 1
LOOP UNTIL INP(957) = 127
OUT 956, 0
DO: t = t + 1
LOOP UNTIL INP(957) = 63
LOCATE 1, 1
c10 = c9
c9 = c8
c8 = c7
c7 = c6
c6 = c5
c5 = c4
c4 = c3
c3 = c2
c2 = c1
c1 = c
c = t
t = 0: f = f + 1
a\$ = INKEY\$
IF a\$ = CHR\$(27) THEN END
GOTO start

health:
LOCATE 5, 1
PRINT "Test Frequency "; f
f = 0
LOCATE 6, 1
PRINT "Raw "; c; ((c - 50) * .00157)
PRINT USING "####.###"; ((((c + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10) / 11) - 50) * .00157) - 10.666

RETURN

Cheers

Wire pin 8 of printer port with 2.2 k to 10 add 10uf (new) to ground then run 2 wires pin 10 for + and ground to capa in question.
Note roughtly 6000 counts for 10 uf 1.6 nf resolution but not stable on p2 233 win 98 just doing my bit to stop ewaist.

burger2227
Veteran
Posts: 2425
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA
capas? layers?
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

smokingwheels
Newbie
Posts: 3
Joined: Wed Dec 14, 2011 8:18 am
capa is tech talk for a capacitor.
In old electronic equipment the loose there value over time and cause problems.

iamdenteddisk
Veteran
Posts: 185
Joined: Mon Jun 30, 2008 4:10 pm
capacitor wonder "changing values" can be due to degradation of plates or leakage of electrolyte. there has been new innovations in capacitor construction in the last decade new electrolytes and metallurgy for plate materials most likely you got the old electrolyte drying out change the caps..

not much else can be done for it but replacement of the "caps" them selves.. you could replace them with new and leave a desiccant pack inside the enclosure and maybe add a fan.

moisture, heat, bugs and stray fields are the worst enemy's of electronics prevent these and you should get 10yrs or better out of devices.

I never heard them called capas either.. that was a girls sorority in my day. "easy marks" kinda like the chess club girls. alphas where the ditzy cheerleaders also known as bad meat by everybody lol..