Author Topic: Frequency/DI to Analog  (Read 13651 times)

cnford1

  • Newbie
  • Posts: 2
  • I love YaBB 1G - SP1!
    • View Profile
Frequency/DI to Analog
« on: June 24, 2003, 12:43:20 PM »
I am new to PLC and have purchased a T100MD888+. I would like to convert a frequency which will reference speed and a digital input which will determine direction and have it scale an analog output. The frequency will be from 0 to 300hz while the digital input will be either a logic 1 (forward) or  0 for reverse. I would like to scale the output of the analog output so I may feed that into the analog input of a microcontroller which will handle the motor output based on the incoming analog input. The microcontroller itself will not handle the frequency and DI that is why I purchased the T100MD. Also, there is a left and right side to this circuit as it will be driving motors on the left and right side of a cart. So I will have frequencies for left and right and DIs for left and right. This will need to output 2 analog signal for left and right.

Thanks in advance for any help that is offered.

Clyde
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Frequency/DI to Analog
« Reply #1 on: June 24, 2003, 02:41:44 PM »
It is unbelievably easy to perform frequency measurement using the T100MD pulse measurement capabiliy ;D . All you need to do is to  execute the PMON 1 function once to enable input #3 as a frequency measurement input. Once enabled, you then simply use the PULSEFREQUENCY(1)  function to read the frequency of the pulses appearing at the input #3. E.g.

   F = PULSEFREQUENCY(1)
  SETDAC 1,F       ' direct output without scaling.

You can measure from 1 Hz to 10000 Hz. You can either execute the above function every scan or use a clock pulse to periodically read the pulse frequency.

The value read into F can then be scaled to whatever value you want or output directly to the analog output using the SETDAC command as shown in the example above.

However, IMHO, using the analog I/O as interface between the PLC and the microcontroller is not exactly  the best method. You could actually design your own communication protocol in the microcontroller so that the frequency value read by the T!00MD+ PLC can be transfered to the microcontroller using the RS485 port without incurring any potential inaccuracy introduced by the analog interface.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cnford1

  • Newbie
  • Posts: 2
  • I love YaBB 1G - SP1!
    • View Profile
Re: Frequency/DI to Analog
« Reply #2 on: June 24, 2003, 03:11:24 PM »
Thank you for repling, the information is very useful. Unfortuneatly, one answer leads to more questions: I still have the problem of the digital input setting direction. I wanted to use the DI so that the frequency of the input would scale up or down based on  the input for direction 0/1. If the DI is 1 scale analog output up based on frequency. If DI is 0 scale analog output down based on frequency. Frequency will always be 0 to 300 but direction would change from forward 1 to reverse 0. I would want to set the Analog out to mid point for scaling up or down. Also, the microcontroller will work with rs232 comunication and not rs 485 unless I get a converter. The only problem with that is " I can't program to save my life". That is why I thought the analog out to analog in would fit my programing limitations.

Thanks again!!!

Clyde ??? ???
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Frequency/DI to Analog
« Reply #3 on: June 25, 2003, 07:20:26 AM »
You can always use the

IF TESTIO(inputlabelname) THEN
....
ELSE
.....
ENDIF

The above test the condition of the DI, and based on the result execute the correct routine. Please read up on the IF THEN ELSE instruction. These are basic programming that you have to learn. There is no "CAN" solution to all programming problem in the world.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Guillermo Renzi

  • Guest
Re: Frequency/DI to Analog
« Reply #4 on: July 18, 2003, 06:15:21 AM »
I can't find the relationship between PMON1 PULSEFREQUENCY(1) with input#3. is that the only available input for this measurements? explain that.
thanks in advance.
GR
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Frequency/DI to Analog
« Reply #5 on: July 18, 2003, 06:53:22 AM »
I believed you have emailed the same question to us, but our reply to your email address was unsuccessful. The reply is the same as below:
----------------------------------------------

Please read page 1-1 of the User's Manual which show
you the mapping of the pulse measurement input with the
physical input. Please note that PM channel #1 is input
#3 and PM channel #2 is input #4. So your pulses must
feed through input #3 and #4 for their respective PMON.
Also the voltage of the pulse input must be compatible
with the PLC input. Did you observe that the input
logic status where the pulse stream is connected has
been turned  ON and OFF repeatedly when performing
online monitoring?

« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS