emsg
-
Posts
6 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Downloads
Posts posted by emsg
-
-
Sir/Madam
I have posting code here again
1.command = "M5000->Y:$078C00,0,12,U"; //Register for 12 bit first ADC of pair
2.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
3.command = "M5002->Y:$078C00,12,12,U"; //Register for 12 bit second ADC of pair
4.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
5.command = "M5004->Y:$078C00,0,24,U"; //register for channel select (value: 0-7)
6.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
7.command = "M5005->Y:$078F30,5,1"; //Register for first ADC ready Flag
8.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
9.command = "M5005"; //Register for first ADC ready Flag
10.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
11.response = response.Trim();
12.LowADCReady = Convert.ToDouble(response);
13.command = "M5006->Y:$078F31,5,1"; //Register for second ADC ready Flag
14.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
15.command = "M5006"; //Register for first ADC ready Flag
16.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
17. response = response.Trim();
18.HighADCReady = Convert.ToDouble(response);
19.command = "M5004=0"; //Select ADC channel
20.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
21. while (LowADCReady != 1 && HighADCReady != 1)
22. {
23. command = "M5005"; //Register for first ADC ready Flag
24. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
25. response = response.Trim();
26. LowADCReady = Convert.ToDouble(response);
27. command = "M5006"; //Register for first ADC ready Flag
28. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
29. response = response.Trim();
30. HighADCReady = Convert.ToDouble(response);
31. }
32. command = "M5000"; //Register for 12 bit first ADC of pair
33. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
34. Console.WriteLine("M5000 o/p = " + response ); // o/p = 2730
35. command = "P2001 = M5000";
36. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
37. command = "P2001"; //Register for 12 bit first ADC of pair
38. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
39. response = response.Trim();
40. Console.WriteLine("P2001 o/p = " + response); // o/p = 0
-
Thank you for guidance
We have Used above commands in PEWIN and terminal window displays its corresponding digital value in P2001 register but with negative sign i.e if input analog voltage is +ve, o/p at ADC+ is -800(its digital value) and if input voltage is negative,o/p at ADC- is positive; that could be due to some setting.
These same commands have been used in csharp code but P2001 register here displays 0 and M5000 register display 2730.We need help in this regard
-
We are using Acc36E on TurboPmac2 to read analog input voltage but there is no output. We need help in regard as it is new for us. c sharp program is as given below:
1.command = "M5000->Y:$078C00,0,12,U"; //Register for 12 bit first ADC of pair
2.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
3.command = "M5002->Y:$078C00,12,12,U"; //Register for 12 bit second ADC of pair
4.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
5.command = "M5004->Y:$078C00,0,24,U"; //register for channel select (value: 0-7)
6.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
7.command = "M5005->Y:$078F30,5,1"; //Register for first ADC ready Flag
8.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
9.command = "M5005"; //Register for first ADC ready Flag
10.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
11.response = response.Trim();
12.LowADCReady = Convert.ToDouble(response);
13.command = "M5006->Y:$078F31,5,1"; //Register for second ADC ready Flag
14.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
15.command = "M5006"; //Register for first ADC ready Flag
16.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
17. response = response.Trim();
18.HighADCReady = Convert.ToDouble(response);
19.command = "M5004=0"; //Select ADC channel
20.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
21. while (LowADCReady != 1 && HighADCReady != 1)
22. {
23. command = "M5005"; //Register for first ADC ready Flag
24. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
25. response = response.Trim();
26. LowADCReady = Convert.ToDouble(response);
27. command = "M5006"; //Register for first ADC ready Flag
28. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
29. response = response.Trim();
30. HighADCReady = Convert.ToDouble(response);
31. }
32. command = "M5000"; //Register for 12 bit first ADC of pair
33. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
34. Console.WriteLine("M5000 o/p = " + response ); // o/p = 2730
35. command = "P2001 = M5000";
36. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
37. command = "P2001"; //Register for 12 bit first ADC of pair
38. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
39. response = response.Trim();
40. Console.WriteLine("P2001 o/p = " + response); // o/p = 0
-
I have updated this thread as ACC 36E was used and csharp code also given
-
we are using ACC 36 E card to read analog input on TurboPMAC2
We have done coding in csharp and tried to access base address of ACC36E
In csharp code, we have initialsed M5000 to point at base address. then assigned M5000 to P2001
output shows M5000 as 2730 and P2001 as 0 continuously even after varying analog input from 0 to 5 V
We are new to TurboPmac and its development in csharp
so require help and guidance. Csharp code is as follows
1.command = "M5000->Y:$078C00,0,12,U"; //Register for 12 bit first ADC of pair
2.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
3.command = "M5002->Y:$078C00,12,12,U"; //Register for 12 bit second ADC of pair
4.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
5.command = "M5004->Y:$078C00,0,24,U"; //register for channel select (value: 0-7)
6.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
7.command = "M5005->Y:$078F30,5,1"; //Register for first ADC ready Flag
8.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
9.command = "M5005"; //Register for first ADC ready Flag
10.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
11.response = response.Trim();
12.LowADCReady = Convert.ToDouble(response);
13.command = "M5006->Y:$078F31,5,1"; //Register for second ADC ready Flag
14.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
15.command = "M5006"; //Register for first ADC ready Flag
16.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
17. response = response.Trim();
18.HighADCReady = Convert.ToDouble(response);
19.command = "M5004=0"; //Select ADC channel
20.Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
21. while (LowADCReady != 1 && HighADCReady != 1)
22. {
23. command = "M5005"; //Register for first ADC ready Flag
24. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
25. response = response.Trim();
26. LowADCReady = Convert.ToDouble(response);
27. command = "M5006"; //Register for first ADC ready Flag
28. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
29. response = response.Trim();
30. HighADCReady = Convert.ToDouble(response);
31. }
32. command = "M5000"; //Register for 12 bit first ADC of pair
33. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
34. Console.WriteLine("M5000 o/p = " + response ); // o/p = 2730
35. command = "P2001 = M5000";
36. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
37. command = "P2001"; //Register for 12 bit first ADC of pair
38. Pmac.GetResponseEx(m_nDevice, command, false, out response, out status);
39. response = response.Trim();
40. Console.WriteLine("P2001 o/p = " + response); // o/p = 0
how to access adc input from ACC 36E in csharp
in Turbo PMAC
Posted