aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/FAN_Drawer_RPM.cs
blob: adb60d09fa2aae0e8e84d544b0425ecae9737fe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Stubs;
using Tango.Stubs;

include "C:\Users\avi\Documents\Tango_stub_exe_tests\Stubs from mati\Scripts\Defines\Tango_Defines_Basic.cs"
include "C:\Users\avi\Documents\Tango_stub_exe_tests\Stubs from mati\Scripts\Defines\Tango_Defines_Tacho.cs"  
	
const Int32 PPR =  0X02; // Pulse/Round
const Int32 OSC_IN =  25000000; // Oscilator IN

Int32 V_rpm;

public void OnExecute(StubManager stubManager)
{
	Int32	temp;
	
	var Prescaler = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , FPGA1 + F1_Prescaler1_reg5);
	Prescaler.Value = Prescaler.Value & 0xffff;
	
	var Tacho = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , FPGA1 + F1_Tacho_reg0);
	Tacho.Value = Tacho.Value & 0xffff;
	
	temp = 60 / PPR;//60 Sec 
	temp = temp   * OSC_IN;
	temp = temp / (Int32)Tacho.Value;
	V_rpm = temp /  (Int32)Prescaler.Value; 
	
	stubManager.Write("\nThe drawer big fan speed is ");	
	stubManager.Write(V_rpm);
	stubManager.Write(" [RPM]");
	
}