Campbell DSP4 Specifikace Strana 154

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 330
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 153
Section 6. Data Table Declarations and Output Processing Instructions
Histogram4D Output Example
'The example program below is an example of using the Histogram4D
'instruction to calculate a 2 dimensional histogram of RPM distribution vs Gear
'\\\\\\\\\\\\\\\\\\\\ VARIABLES and CONSTANTS ////////////////////
Public RPM, Gear, Port(4)
Dim Bin(2)
'\\\\\\\\\\\\\\\\\\\\\\\\ OUTPUT SECTION ////////////////////////
DataTable (RPMvsG,1,100)
DataInterval(0,60,Min,100)
Histogram4D(Bin(), FP2, 0,4,8, 0, 0,000,1,0.5, 4.5, 0,8000, 0, 0, 0, 0)
'4 bins for gear, range 0.5 to 4.5; 8 bins for RPM range 0 to 8000
'Open form so that RPM >8000 is included in 7000 to 8000 bin
EndTable
'\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ///////////////////////////
BeginProg
Scan (100,mSec,3,0)
PulseCount (RPM,1,1 ,1,1,0.4225,0) 'RPM from pick up on 142 tooth fly wheel
'60 rpm/142 Hz = 0.42253 ...
Portget (Port(1),1) 'There are digital inputs to ports 1 to 4
Portget (Port(2),2) 'If C1 is high then the car is in first gear
Portget (Port(3),3) 'C2 indicates 2nd gear etc.
Portget (Port(4),4)
IF Port(1) then Gear = 1
If Port(2) Then Gear = 2
If Port(3) Then Gear = 3
If Port(4) Then Gear = 4
Bin(1) = Gear
Bin(2) = RPM
CallTable RPMvsG
Next Scan
EndProg
6-20
Zobrazit stránku 153
1 2 ... 149 150 151 152 153 154 155 156 157 158 159 ... 329 330

Komentáře k této Příručce

Žádné komentáře