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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
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.UI;
/*** LTFU SSI Encoders ***/
const Int32 F1_LDANCER1_ROTENC_MSB = 0x01c2;
const Int32 F1_LDANCER1_ROTENC_LSB = 0x01c0;
const Int32 F1_LDANCER1_ROTENC_TX = 0x01ce;
const Int32 F1_LDANCER2_ROTENC_MSB = 0x01b2;
const Int32 F1_LDANCER2_ROTENC_LSB = 0x01b0;
const Int32 F1_LDANCER2_ROTENC_TX = 0x01be;
const Int32 F1_LSPARE_ROTENC_MSB = 0x0192;
const Int32 F1_LSPARE_ROTENC_LSB = 0x0190;
const Int32 F1_LSPARE_ROTENC_TX = 0x019e;
/*** RTFU SSI Encoders ***/
const Int32 F1_RDANCER_ROTENC_MSB = 0x01a2;
const Int32 F1_RDANCER_ROTENC_LSB = 0x01a0;
const Int32 F1_RDANCER_ROTENC_TX = 0x01ae;
const Int32 F1_RSPARE_ROTENC_MSB = 0x0182;
const Int32 F1_RSPARE_ROTENC_LSB = 0x0180;
const Int32 F1_RSPARE_ROTENC_TX = 0x018e;
/*** RTFU and LTFU SSI Prescalers ***/
const Int32 F1_Prescaler1_reg1 = 0x03e0;
const Int32 F1_Prescaler1_reg2 = 0x03e2;
const Int32 F1_SPI_Busy1_Direct = 0x0090;
int ssi_loop(Int32 Addr)
{
var RetValue = Fpga_Read_Reg(FPGA1, F1_SPI_Busy1_Direct,10);
if ( (RetValue.Value&0x1f) == 0)
{
//stubManager.Write("\nWriting to F1 DANCER TX");
//Trigger SSI Tx
Fpga_Write_Reg(FPGA1, Addr, 0xffff, 0);
//Wait for SSI sequence to finish
Thread.Sleep(800);
}
RetValue.Value = 1;
return 1;
}
int SSI_Read_Write(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 TxAdr)
{
var rv1 = Fpga_Read_Reg(Fpga, HighAdr, 0);
var rv2 = Fpga_Read_Reg(Fpga, LowAdr, 0);
stubManager.Write(" Adr = ");
stubManager.WriteHex(TxAdr,4);
stubManager.Write(" (");
stubManager.WriteHex(rv1.Value,4); stubManager.Write(", ");
stubManager.WriteHex(rv2.Value,4); stubManager.Write(")");
//if ( (rv2.Value&0x200) == 0x200) stubManager.Write(" Error");
Fpga_Write_Reg(Fpga, TxAdr, 0xffff, 0);
Thread.Sleep(100);
return 1;
}
|