Jump to content
OMRON Forums

Problem reading analog input


emsg
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Can you read the ADCs in PMAC (e.g. from the PewinPro2)?

- If you can, then the problem is with the C# code

- If you cannot, then the problem is with the settings or hardware in PMAC

 

I strongly suggest implementing one of the automatic methods (described in the manual) to read the ADCs in PMAC, and just report those to the C#.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...