Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:sw:01-mervis:advanced-modes-of-digital-outputs-hidden [2021/08/05 12:12]
avsetula
en:sw:01-mervis:advanced-modes-of-digital-outputs-hidden [2021/08/27 15:08] (current)
avsetula
Line 23: Line 23:
 Another thing considering the frequency is the switching element you are turning ''​ON''​ and ''​OFF''​. If it is a mechanical relay, you have to use very low frequency or you could destroy it. If it is SSR relay, MOSFET or IGBT transistor, you can set couple of kHz or even MHz (always referr to the datasheet of the component). Another thing considering the frequency is the switching element you are turning ''​ON''​ and ''​OFF''​. If it is a mechanical relay, you have to use very low frequency or you could destroy it. If it is SSR relay, MOSFET or IGBT transistor, you can set couple of kHz or even MHz (always referr to the datasheet of the component).
  
-The frequency of the PWM in UniPi depends on the used resolution. See below.+The frequency of the PWM in Unipi depends on the used resolution. See below.
  
  
Line 29: Line 29:
 Second parameter of the PWM is the **resolution**. This value indicates in **how many steps** we want to divide the regulation. If the resolution is 3, we can set the duty cycle to 3 values: 0 %, 50 % and 100 %. If the resolution is 11, we can set it from 0 % to 100 % in the steps of 10 %. Second parameter of the PWM is the **resolution**. This value indicates in **how many steps** we want to divide the regulation. If the resolution is 3, we can set the duty cycle to 3 values: 0 %, 50 % and 100 %. If the resolution is 11, we can set it from 0 % to 100 % in the steps of 10 %.
  
-In UniPi controllers,​ you can set the resolution up to 65536 steps.+In Unipi controllers,​ you can set the resolution up to 65536 steps.
  
  
Line 140: Line 140:
  
 ===== Setting the PWM in Mervis ===== ===== Setting the PWM in Mervis =====
-The **PWM_Cycle** and **PWM_Prescale** are configuration variables of the UniPi module and cannot be changed from the program. Select the UniPi module in the **Left panel**. In the **Properties panel**, you can find the **PWM_Cycle** and **PWM_Prescale** variables. Set those according to your calculations. We will set it to **PWM_Cycle** = 99 and **PWM_Prescale** = 119. This will set the frequency to 4 kHz with resolution of 101.+The **PWM_Cycle** and **PWM_Prescale** are configuration variables of the Unipi module and cannot be changed from the program. Select the Unipi module in the **Left panel**. In the **Properties panel**, you can find the **PWM_Cycle** and **PWM_Prescale** variables. Set those according to your calculations. We will set it to **PWM_Cycle** = 99 and **PWM_Prescale** = 119. This will set the frequency to 4 kHz with resolution of 101.
  
 {{ :​en:​sw:​01-mervis:​pwm-01-selecting-module.png?​direct |}} {{ :​en:​sw:​01-mervis:​pwm-01-selecting-module.png?​direct |}}
  
-The change has been done on the prototype of the device, which means it is a change in the PLC module'​s configuration. To upload the configuration,​ check the [[en:​sw:​01-mervis:​unipi-configure-module-hidden|Configuration of the UniPi module]] tutorial.+The change has been done on the prototype of the device, which means it is a change in the PLC module'​s configuration. To upload the configuration,​ check the [[en:​sw:​01-mervis:​unipi-configure-module-hidden|Configuration of the Unipi module]] tutorial.
  
 Now let's check which variables we have available for working with PWM. Select the **Variable browser** tab on the **Main window**. Under the **Name** column, enter the **PWM** into the search box. You should see similar list. Now let's check which variables we have available for working with PWM. Select the **Variable browser** tab on the **Main window**. Under the **Name** column, enter the **PWM** into the search box. You should see similar list.
Line 152: Line 152:
 Turn on the **Debugging** and in the column **PLC Value**, you will see the current PWM value of DO ports 1.01-1.04. If you didn't change it previously, you should see zeros. Change the value of **PWM_1.01** to 50 and confirm by clicking on {{:​files:​dialog-confirm_button_2.png?​nolink|}} or submiting with **ENTER**. Turn on the **Debugging** and in the column **PLC Value**, you will see the current PWM value of DO ports 1.01-1.04. If you didn't change it previously, you should see zeros. Change the value of **PWM_1.01** to 50 and confirm by clicking on {{:​files:​dialog-confirm_button_2.png?​nolink|}} or submiting with **ENTER**.
  
-We can hook up the oscilloscope to the UniPi's DO 1.01 and check the waveform.+We can hook up the oscilloscope to the Unipi's DO 1.01 and check the waveform.
  
 {{ :​en:​sw:​01-mervis:​pic_425_2.gif?​direct |}} {{ :​en:​sw:​01-mervis:​pic_425_2.gif?​direct |}}