This project has also an i2c interface to a 4 digit 7 segment led module. I'm using chan 0 for the i2c to avoid resource conflicts, but i'm not sure the problem is i2c related as if i comment out the i2c open i still see the problem which is this. The code works fine for about a minute and then debug traces all return blank (i thought cstr(0) would print zero but it doesn't in this case - maybe a clue).
Code: Select all
Call InputCapture (pulses, pulseStreamLen, 0,20)
'debug.print cstr(pulses(1))
if pulses(1)=65534 then
rpm=0.0
debug.print "No"
exit sub
end if
sn_Temp=0.0
for by_Cnt=1 to 20
sn_Temp=sn_Temp+CSng(pulses(by_Cnt))
'debug.print cstr(by_cnt);" ";cstr(pulses(by_Cnt))
next by_Cnt
'debug.print " avg=";cstr(sn_Temp); " ";
sn_temp=sn_Temp*0.0000542 '542/10000000 inc avg divide
rpm=((1.0/sn_temp)*30000.0) * 2.0 '*2 for motorbike
1 40843
2 10898
3 40917
4 10619
5 40500
6 12577
7 40769
8 12849
9 41635
10 10855
11 42042
12 10249
13 41415
14 11409
15 41254
16 11980
17 41436
18 10954
19 41664
20 10118
2109
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2151
i saw this behaviour on my test zx24 device also but put this down to s/w i2c and a resource conflict. i need to check if the working shift light project is a VM or native ZX, i can't remember at the moment.
any pointers much appreciated. can send the whole test code if required, its quite small.
thanks