Mitsubishi Electric MELSEC-Q64DA, MELSEC-Q64DAN Reference Manual

MELSEC-Q Digital-Analog Converter Module FB Library Reference Manual
Applicable modules:
Q64DA, Q64DAN
<CONTENTS>
Reference Manual Rev ision History ............................................................................................................................... 2
1. Overview ............................................................................................................................................................ 3
1.1. Overview of the FB Library ............................................................................................................................. 3
1.3. System Configuration Example ...................................................................................................................... 4
1.4. Relevant Manuals ........................................................................................................................................... 4
1.5. Note ................................................................................................................................................................. 4
2. Details of the FB Library ..................................................................................................................................... 5
2.1. M+Q64DA_Writ eDAVal (DA conversion data write) ....................................................................................... 5
2.3. M+Q64DA_SetDAConversion (DA conversion enable/disable setting) ....................................................... 13
2.6. M+Q64DA_SetOffsetVal (Offset setting) ...................................................................................................... 25
Appendix 1. FB Library Application Examples ......................................................................................................... 39
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
FBM-M042-B
1/49

Reference Manual Revision History

Reference Manual Number Date Description FBM-M042-A 2010/12/10 First edition FBM-M042-B 2015/03/27 1) Added applicable GX Works2 Version.
This FB is able to install on GX Works2 of all lan guage versions.
2) Added the following "FB Version Upgrade Hist or y" .
M+Q64DA_SetOffsetVal
M+Q64DA_SetGainVal
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
FBM-M042-B
2/49

1. Overview

nable/disable sett ing of a specified channe l or all

1.1. Overview of the FB Library This FB Library is for using t he M EL SEC-Q Digital-Analog Converter Module.

1.2. Function of the FB Library

Item Description M+Q64DA_WriteDAVal Writes DA conversion data of a specified channel. M+Q64DA_WriteAllDAVal Writes DA conversion data of all channels. M+Q64DA_SetDAConversion Sets the DA conversion e nable/disable setting of a specified channel
or all channels.
M+Q64DA_SetDAOutput Sets the DA output e
channels. M+Q64DA_RequestSetting Enables settings of each f unct ion. M+Q64DA_SetOffsetVal Performs offset setting of a specified channe l. M+Q64DA_SetGainVal Performs gain setting of a specified channel. M+Q64DA_ErrorOperation Monitors error codes and per f orms error reset.
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
FBM-M042-B
3/49
CPU module (
QCPU
)
D/
A converter module (Q64DA)
Power supply module
Input
module
(QX40)
Output module (QY40)

1.3. System Configuration Example

1.4. Relevant Manuals

Digital-Analog Converter Module User 's Manual
QCPU User's Manual (Har dw ar e D esign, Maintenance and Inspection)
GX Works2 Version 1 Op er at ing Manual (Common)
GX Works2 Version 1 Op er at ing Manual (Simple Project, Fu nction Block)

1.5. Note Please make sure to read user 's manuals for the corresponding products before using the products.

MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
FBM-M042-B
4/49

2. Details of the FB Library

Execution command B : FB_EN FB_ENO : B Execution status
Modu le start XY addre ss W : i_Start_IO_No FB_OK : B Completed without error
Channel No. W : i_CH FB_ ERROR : B Error flag
Digital value W : i_ DA_Value ERROR_ID : W Error code M+Q64DA_WriteDAVal

2.1. M+Q64DA_WriteDAVal (DA conversion dat a write)

FB Name
M+Q64DA_WriteDAVal
Function Overview
Item Description Function overview Writes DA conversion data of a specified channel. Symbol
Applicable hardware and software
Digital-analog
Q64DA, Q64DAN converter module CPU module
Series Model
MELSEC-Q Series* High performance model
* Not applicable for QCP U ( A mode) Engineering softwar e GX Works2 *1
Language Software version Japanese version Version1.86Q or later English version Version1.24A or later Chinese (Simplified) version Version1.49B or later Chinese (Traditional) version Version1.49B or later Korean version Version1.49B or later
*1 For software versions applicable to the modules used, refer to
"Relevant Manuals".
Universal model
Programming
Ladder language Number of steps 181 steps (for MELSEC-Q series universal model CPU)
* The number of ste ps of the FB in a program depen ds on the CPU model that is used and
input and output definition.
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
5/49
FBM-M042-B
Item Description
4) When two or more of these FBs are used, prec aution must be ta ken to avoid repet ition of
he output range, sync hronous out put mode, resoluti on mode, an d operat ion mode must
Refreshing
stop
FB_EN (Execution command)
FB_ENO (Execution status)
FB_OK (Completed without error)
FB_ERROR(Error flag)
ERROR_ID(Error code)
0
CH digital input value (Un\ G1 to 4)
Refreshing
stop
Refreshing
FB_EN (Execution command)
FB_ENO (Execution status)
FB_OK (Completed without error)
FB_ERROR (Error flag)
ERROR_ID (Error code)
0
10(Decimal)
0
CH digital input value (Un\ G1 to 4)
Refreshing stop
Function description 1) By turning ON FB_EN (Execution command), DA conv er sion data is written t o t he
specified channel.
2) The DA conversion data to be written depends on the r esol ut ion mode setting.
3) When the input value is invali d, t he FB_ERROR output turns O N, pr ocessing is interrupted, and the error code is stored in ERROR_I D (Err or code). Refer to the error code expla nat ion section for details.
Compiling method Macro type Restrictions and precautions
1) The FB does not inclu de error recovery processi ng. Program the error recovery processing separately in accordance with the required system operation.
2) The FB cannot be use d in an interrupt program.
3) Please ensure that the FB_EN signa l is capable of bein g turned OFF by t he program. Do not use this FB in programs that ar e only executed once such as a su br outine, FOR-NEXT loop, etc. because it is impossible to turn O FF.
the target channel.
5) This FB uses index re gisters Z7, Z8 and Z9. Please do not use these index registers in an interrupt program.
6) Every input must be provided w ith a value for proper FB operation.
7) If the auto refresh is set using GX Configurator-DA or the con figur at ion function of GX Works 2, using this FB is unnecessary.
8) T be configured to match devices and systems connec t ed t o t he Q64DA m odule. Configure these settings b y making the GX Works2 switch setting according t o t he application. For details on how to use the inte ll ige nt function module switch setting, refer to GX Works2 Operating Manual (Common).
FB operation type Real-time execution Application example Refer to "Appendix 1. FB Library Application Examples". Timing chart [When operation complet es without error] [When an error occurs]
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
6/49
FBM-M042-B
Item Description Relevant manual
Digital-Analog Converter Module User 's Manual
QCPU User's Manual (Har dw ar e D esign, Maintenance and I nspec tion)
GX Works2 Version 1 Op er at ing Manual (Common)
GX Works2 Version 1 Op er at ing Manual (Simple Project, Fu nction Block)
Error codes
Error code list Error code Description 10 (Decimal) The specified target channel is not valid. The target channel is not within the range of the
number of channels of the mou nt ed module. Please try again a f ter confirming the sett ing.
Labels
Input labels Name (Comment) Label name Data
Setting range Description
type
Execution
FB_EN Bit ON, OFF ON: The FB is activat ed. command Module start XY address
i_Start_IO_No Word Depends on the I/O point
range. For details, refer to the CPU user's manual.
OFF: The FB is not activated. Specify the starting XY address (in hexadecima l) where the Q64DA module is mounted. (For example, e nt er
H10 for X10.) Channel No. i_CH Word 1~4 Specify the channel number. Digital value i_DA_Value Word Depends on the output
range setting and resolution setting of the specified
For details on the setting
range of the digital valu e, r efer
to the relevant manual.
channel.
Output labels
Name (Comment) Label name Data
type
Initial value
Description
Execution status FB_ENO Bit OFF ON: Execution command is ON
OFF: Execution command is OFF. Completed without error
FB_OK Bit OFF When ON, it indicates that DA conversion value is
being written. Error flag FB_ERROR Bit OFF When ON, it indicates that an error has occurred. Error code ERROR_ID Word 0 FB error code output.
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
FBM-M042-B
7/49
FB Version Upgrade Hist ory
Version Date Description
1.00A 2010/12/10 First edition
Note
This chapter includes information related to the M+Q64DA_Write D AVal function block. It does not include informat ion o n r estrictions of use such as com bi nation with digital-a nalog converter modules or programmable controller CP Us. Before using any Mitsubishi products, pleas e read all the relevant manuals.
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
FBM-M042-B
8/49
Execution command B : FB_EN FB_ENO : B Execution status
Modu le start XY address
W : i_Start_IO_No FB_OK : B Completed without error
Channel 1 digital value
W : i_ DA_Value CH1 FB_ ERROR : B Error flag
Channel 2 digital value W : i_DA_Valu eCH2 ERROR_ID : W Error code
Channel 3 digital value W : i_DA_Valu eCH3
Channel 4 digital value W : i_DA_Valu eCH4
M+Q6 4DA_WriteAllDAVal

2.2. M+Q64DA_WriteAllDAVal (DA conversion data write (All CHs))

FB Name
M+Q64DA_WriteAllDAVal
Function Overview
Item Description Function overview Writes DA conversion data of all channels. Symbol
Applicable hardware and software
Digital-analog
Q64DA, Q64DAN converter module CPU module
Series Model
MELSEC-Q Series* High performance model
* Not applicable for QCP U ( A mode) Engineering softwar e GX Works2 *1
Language Software version Japanese version Version1.86Q or later English version Version1.24A or later Chinese (Simplified) version Version1.49B or later Chinese (Traditional) version Version1.49B or later Korean version Version1.49B or later
*1 For software versions applicable to the modu les used, refer to
Universal model
"Relevant Manuals".
Programming
Ladder language Number of steps 177 steps (for MELSEC-Q series universal model CPU)
* The number of ste ps of the FB in a program depen ds on the CPU model that is used and
input and output definition.
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
9/49
FBM-M042-B
Item Description
8) The output range, sync hronous output m ode, resoluti on mode, and operat ion mod e must
Refreshing
stop
FB_EN (Execution command)
FB_ENO (Execution status)
FB_OK (Completed without error)
FB_ERROR(Error flag)
ERROR_ID(Error code)
0
CH digital input value (Un\ G1 to 4)
Refreshing
stop
Refreshing
Function description 1) By turning ON FB_E N (Execution command), D A conversion data is written to the all
channels.
2) The DA conv ersion dat a t o be written to t he all channels de pends on the re solution mode setting.
Compiling method Macro type Restrictions and precautions
1) The FB does not inclu de error recovery processi ng. Program the error recovery processing separately in accordance with the required system operation.
2) The FB cannot be use d in an interrupt program.
3) Please ensure that the FB_EN signa l is capable of bein g turned OFF by t he program. Do not use this FB in programs that ar e only executed once such as a su br outine, FOR-NEXT loop, etc. because it is impossible to turn O FF.
4) When two or more of these FBs are used, prec aution must be ta ken to avoid repetition of the target channel.
5) This FB uses index re gisters Z8 and Z9. Please do not use these index registers in an interrupt program.
6) Every input must be provided w ith a value for proper FB operation.
7) If the auto refresh is set using GX Configurator-DA or the con figur at ion function of GX Works 2, using this FB is unnecessary.
be configured to match devices and systems connec t ed t o t he Q64DA m odule. Configure these settings b y making the GX Works2 switch setting according t o t he application. For details on how to use t he int elligent function module s w itc h set t ing, refer to GX Works2 Operating Manual (Common).
FB operation type Real-time execution Application example Refer to "Appendix 1. FB Library Application Examples". Timing chart
Relevant manual
Digital-Analog Converter Module User 's Manual
QCPU User's Manual (Har dw ar e D esign, Maintenance and I nspec tion)
GX Works2 Version 1 Operating Manual (Common)
GX Works2 Version 1 Op er at ing Manual (Simple Project, Fu nction Block)
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
10/49
FBM-M042-B
Error codes
Error code list Error code Description None No errors are stored for this FB.
Labels
Input labels Name (Comment) Label name Data
type
Execution
FB_EN Bit ON, OFF ON: The FB is activat ed. command Module start XY
i_Start_IO_No Word Depends on the I/O point address
Channel 1 digital
i_DA_ValueCH1 Word Depends on the output value
Channel 2 digital
i_DA_ValueCH2 Word Depends on the output value
Channel 3 digital
i_DA_ValueCH3 Word Depends on the output
Setting range Description
OFF: The FB is not activ ated.
Specify the starting XY range. For details, refer to the CPU user's manual.
address (in hexadecima l)
where the Q64DA module is
mounted. (For example, e nt er
H10 for X10.)
Writes the digital conversion range setting and resolution
value of the channel 1. setting of the channel 1.
Writes the digital conversion range setting and resolution
value of the channel 2. setting of the channel 2.
Writes the digital conversion
value
Channel 4 digital value
range setting and resolution setting of the channel 3.
i_DA_ValueCH4 Word Depends on the output
range setting and resolution setting of the channel 4.
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
11/49
value of the channel 3.
Writes the digital conversion
value of the channel 4.
FBM-M042-B
Output labels
Name (Comment) Label name Data
type
Initial value
Description
Execution status FB_ENO Bit OFF ON: Execution command is ON.
OFF: Execution comman d is OFF. Completed without error
FB_OK Bit OFF When ON, it indicates t hat DA conversion values of
all channels are being writt en. Error flag FB_ERROR Bit OFF When ON, it indicates that an error has occurred. Error code ERROR_ID Word 0 FB error code output.
FB Version Upgrade Hist ory
Version Date Description
1.00A 2010/12/10 First edition
Note
This chapter includes information related to the M+Q64DA_WriteAllDAVal function bloc k. It does not include informat ion o n r estrictions of use such as com bi nation with digital-a nalog converter modules or programmable controller CPUs. Before using any Mitsubishi products, pleas e r ead all the relevant manuals.
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
FBM-M042-B
12/49
Execution command B : FB_EN FB_ENO : B Execution status
Modu le start XY addre ss W : i_Start_IO_No FB_OK : B
Completed without error
Channel No. W : i_CH FB_ERROR : B Error f lag
B : i_DA_ Enable ERROR_ID : W Error code
M+Q64DA_SetDAConversion
DA conversion
enable/disable setting

2.3. M+Q64DA_SetDAConversion (DA conversion enable/disable setting)

FB Name
M+Q64DA_SetDAConversion
Function Overview
Item Description Function overview Sets the DA conversion enable/disable setting of a specified channel or all channels. Symbol
Applicable hardware and software
Digital-analog
Q64DA, Q64DAN converter module CPU module
Series Model
MELSEC-Q Series* High performance model
* Not applicable for QCP U ( A mode) Engineering softwar e GX Works2 *1
Language Software version Japanese version Version1.86Q or later English version Version1.24A or later Chinese (Simplified) version Version1.49B or later Chinese (Traditional) version Version1.49B or later Korean version Version1.49B or later
*1 For software versions applicable to the modules used, refer to
"Relevant Manuals".
Universal model
Programming
Ladder language Number of steps 245 steps (for MELSEC-Q series universal model CPU)
* The number of ste ps of the FB in a program depen ds on the CPU model that is used and
input and output definition.
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
13/49
FBM-M042-B
Item Description
The setting value is enabled by turning ON the operating condition set t ing request signal
4) When two or more of these FBs are used, prec aution must be ta ken to avoid repet ition of
8) The output range, sync hronous output m ode, resoluti on mode, and operat ion mod e must
Function description 1) By turning ON FB_EN (Execution command), the DA conver sion enable/disable sett ing
of the specified channel is set .
2) FB operation is one-shot only, triggered by the FB_EN signal.
3) (Y9) or by executing the operat ing condition setting request FB (M+Q64DA_RequestSetting).
4) When the input value is inv alid, the FB_ERROR output tur ns O N, pr ocessing is interrupted, and the error code is stored in ERROR_ID (Error c ode). Refer to the error code expla nat ion section for details.
Compiling method Macro type Restrictions and precautions
1) The FB does not inclu de error recovery processi ng. Program the error recovery processing separately in accordance with the required system operation.
2) The FB cannot be use d in an interrupt program.
3) Please ensure that the FB_EN signa l is capable of bein g turned OFF by t he program. Do not use this FB in programs that ar e only executed once such as a su br outine, FOR-NEXT loop, etc. because it is impossible to turn O FF.
the target channe l.
5) This FB uses index re gisters Z7, Z8 and Z9. Please do not use these index registers in an interrupt program.
6) Every input must be provided w ith a value for proper FB operation.
7) If the auto refresh is set using GX Configurator-DA or the configuration function of GX Works 2, using this FB is unnecessary.
be configured to match devices and systems connec t ed t o t he Q64DA m odule. Configure these settings b y making the GX Works2 switch setting according t o t he application. For details on how to use t he int elligent function module s w itc h set t ing, refer to GX Works2 Operating Manual (Common).
FB operation type Pulsed execution (1 scan execution type) Application example Refer to "Appendix 1. FB Library Application Examples".
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
14/49
FBM-M042-B
Item Description
FB_EN (Execution command)
FB_ENO (Execution status)
FB_OK (Completed without error)
FB_ERROR (Error flag)
ERROR_ID(Error code) 0
DA conversion enable/disable setting write processing
No processing
Writing
No processing
No processing
FB_EN (Execution command)
FB_ENO (Execution status)
FB_OK (Completed without error)
FB_ERROR (Error flag
)
ERROR_ID (Error code)
DA conversion enable/disable setting write processing
0
10(Decimal) 0
Timing chart [When operation complet es without error] [When an error occurs]
Relevant manual
Digital-Analog Converter Module User 's Manual
QCPU User's Manual (Har dw ar e D esign, Maintenance and I nspec tion)
GX Works2 Version 1 Op er at ing Manual (Common)
GX Works2 Version 1 Op er at ing Manual (Simple Project, Fu nction Block)
Error codes
Error code list Error code Description 10 (Decimal) The specified target channel is not valid. The tar get channel is not within the range of the
number of channels of the mou nt ed module. Please try again a f ter confirming the sett ing.
Labels
Input labels Name (Comment) Label name Data
Setting range Description
type
Execution
FB_EN Bit ON, OFF ON: The FB is activat ed. command Module start XY
i_Start_IO_No Word Depends on the I/O point address
Channel No. i_CH Word As shown on the right. Specify the channel numb er.
DA conversion
i_DA_Enable Bit ON, OFF ON: DA conversion enabled. enable/disable setting
OFF: The FB is not activ ated.
Specify the starting XY range. For details, refer to the CPU user's manual.
address (in hexadecimal)
where the Q64DA module is
mounted. (For example, e nt er
H10 for X10.)
Q64DA, Q64DAN: 1~4
All channels at once: 15(0F H)
OFF: DA conversion disabled.
MELSEC-Q Digital-A nal og Conv er ter Mod ule FB Libr a r y Referenc e Man ua l
FBM-M042-B
15/49
Loading...
+ 34 hidden pages