📄 mmz_rab.lib
字号:
}
For rs485 control, you can do the following;
EXAMPLE: void mmCtx(void)
{
// Ensure that all the data has bent sent.
/ Turn on the RS485 transmitter by doing the following;
// PORT: The parrallel port (PADR,PBDR,PCDR etc)
// PORTShadow: The Shadow register of the port
// ON_VALUE: 1 or 0
// PORT_BIT: parrallel port bit (0-7)
BitWrPortI(PORT,&PORTShadow, ON_VALUE, PORT_BIT);
// If your product is a Zworld SBC, you can do the following
ser485Tx();
}
RETURN VALUE: none
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
mmDrx <MMZ_RAB.LIB>
NOTE: MMZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void mmDrx (void)
DESCRIPTION: User defineable function for disabling the rs485
transmitter. This function is needed in your application
code. If you are doing RS232, you need only to have
an empty function like
void mmDrx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void mmDrx(void)
{
// Ensure that all the data has bent sent.
while (serDwrUsed() || \
BitRdPortI(SDSR,2) || \
BitRdPortI(SDSR,3));
// Turn off the RS485 transmitter by doing the following;
// PORT: The parrallel port (PADR,PBDR,PCDR etc)
// PORTShadow: The Shadow register of the port
// OFF_VALUE: 1 or 0
// PORT_BIT: parrallel port bit (0-7)
BitWrPortI(PORT,&PORTShadow, OFF_VALUE, PORT_BIT);
// if your product is a Zworld SBC, you can do the following
// instead
ser485Rx();
// Flush out the serial port read buffer, so you are ready for
// the next packet.
serDrdFlush();
}
RETURN VALUE: none
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
mmDtx <MMZ_RAB.LIB>
NOTE: MMZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void mmDtx (void)
DESCRIPTION: User defineable function for enabling the rs485
transmitter. This function is needed in your application
code. If you are doing RS232, you need only to have
an empty function like
void mmDtx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void mmDtx(void)
{
// Ensure that all the data has bent sent.
/ Turn on the RS485 transmitter by doing the following;
// PORT: The parrallel port (PADR,PBDR,PCDR etc)
// PORTShadow: The Shadow register of the port
// ON_VALUE: 1 or 0
// PORT_BIT: parrallel port bit (0-7)
BitWrPortI(PORT,&PORTShadow, ON_VALUE, PORT_BIT);
// If your product is a Zworld SBC, you can do the following
// instead
ser485Tx();
}
RETURN VALUE: none
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
mmDopen <MMZ_RAB.LIB>
NOTE: MMZ_RAB.LIB functions are generally not reentrant.
SYNTAX: int mmDopen(unsigned qBaud)
DESCRIPTION: User function for
Initializing serial port D as a Modbus Master.
This function must reside in your application code.
Typical code for this function would be the following;
int mmDopen(unsigned qBaud)
{
// Open the serial port. THIS MUST BE DONE PRIOR TO SETTING THE
// DATA BITS AND PARITY SETTINGS.
if (serDopen(qBaud))
{
// setup parity. Either PARAM_OPARITY, PARAM_EPARITY, PARAM_NOPARITY,
// or PARAM_2STOP
serDparity(PARAM_EPARITY);
// setup data bits. Either PARAM_7BIT, or PARAM_8BIT
serDdatabits(PARAM_8BIT);
// Set the Serial port mode. Used for Zworld SBC's only.
serMode(0);
return(1);
}
else return 0;
}
PARAMETER1: slave address.
PARAMETER2: baud rate (bits per second).
RETURN VALUE: 1 if successful, 0 if unsupported baud rate.
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
mmErx <MMZ_RAB.LIB>
NOTE: MMZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void mmErx (void)
DESCRIPTION: User defineable function for disabling the rs485
transmitter. This function is needed in your application
code. If you are doing RS232, you need only to have
an empty function like
void mmErx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void mmErx(void)
{
// Ensure that all the data has bent sent.
while (serEwrUsed() || \
BitRdPortI(SESR,2) || \
BitRdPortI(SESR,3));
// Turn off the RS485 transmitter by doing the following;
// PORT: The parrallel port (PADR,PBDR,PCDR etc)
// PORTShadow: The Shadow register of the port
// OFF_VALUE: 1 or 0
// PORT_BIT: parrallel port bit (0-7)
BitWrPortI(PORT,&PORTShadow, OFF_VALUE, PORT_BIT);
// if your product is a Zworld SBC, you can do the following
// instead
ser485Rx();
// Flush out the serial port read buffer, so you are ready for
// the next packet.
serErdFlush();
}
RETURN VALUE: none
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
mmEtx <MMZ_RAB.LIB>
NOTE: MMZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void mmEtx (void)
DESCRIPTION: User defineable function for enabling the rs485
transmitter. This function is needed in your application
code. If you are doing RS232, you need only to have
an empty function like
void mmEtx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void mmEtx(void)
{
// Ensure that all the data has bent sent.
/ Turn on the RS485 transmitter by doing the following;
// PORT: The parrallel port (PADR,PBDR,PCDR etc)
// PORTShadow: The Shadow register of the port
// ON_VALUE: 1 or 0
// PORT_BIT: parrallel port bit (0-7)
BitWrPortI(PORT,&PORTShadow, ON_VALUE, PORT_BIT);
// If your product is a Zworld SBC, you can do the following
// instead
ser485Tx();
}
RETURN VALUE: none
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
mmEopen <MMZ_RAB.LIB>
NOTE: MMZ_RAB.LIB functions are generally not reentrant.
SYNTAX: int mmEopen(unsigned qBaud)
DESCRIPTION: User function for
Initializing serial port E as a Modbus Master.
This function must reside in your application code.
Typical code for this function would be the following;
int mmEopen(unsigned qBaud)
{
// Open the serial port. THIS MUST BE DONE PRIOR TO SETTING THE
// DATA BITS AND PARITY SETTINGS.
if (serEopen(qBaud))
{
// setup parity. Either PARAM_OPARITY, PARAM_EPARITY, PARAM_NOPARITY,
// or PARAM_2STOP
serEparity(PARAM_EPARITY);
// setup data bits. Either PARAM_7BIT, or PARAM_8BIT
serEdatabits(PARAM_8BIT);
// Set the Serial port mode. Used for Zworld SBC's only.
serMode(0);
return(1);
}
else return (0);
}
PARAMETER1: slave address.
PARAMETER2: baud rate (bits per second).
RETURN VALUE: 1 if successful, 0 if unsupported baud rate.
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
mmFrx <MMZ_RAB.LIB>
NOTE: MMZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void mmFrx (void)
DESCRIPTION: User defineable function for disabling the rs485
transmitter. This function is needed in your application
code. If you are doing RS232, you need only to have
an empty function like
void mmFrx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void mmFrx(void)
{
// Ensure that all the data has bent sent.
while (serFwrUsed() || \
BitRdPortI(SFSR,2) || \
BitRdPortI(SFSR,3));
// Turn off the RS485 transmitter by doing the following;
// PORT: The parrallel port (PADR,PBDR,PCDR etc)
// PORTShadow: The Shadow register of the port
// OFF_VALUE: 1 or 0
// PORT_BIT: parrallel port bit (0-7)
BitWrPortI(PORT,&PORTShadow, OFF_VALUE, PORT_BIT);
// if your product is a Zworld SBC, you can do the following
// instead
ser485Rx();
// Flush out the serial port read buffer, so you are ready for
// the next packet.
serFrdFlush();
}
RETURN VALUE: none
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
mmFopen <MMZ_RAB.LIB>
NOTE: MMZ_RAB.LIB functions are generally not reentrant.
SYNTAX: int mmFopen(unsigned qBaud)
DESCRIPTION: User function for
Initializing serial port F as a Modbus Master.
This function must reside in your application code.
Typical code for this function would be the following;
int mmFopen(unsigned qBaud)
{
// Open the serial port. THIS MUST BE DONE PRIOR TO SETTING THE
// DATA BITS AND PARITY SETTINGS.
if (serFopen(qBaud))
{
// setup parity. Either PARAM_OPARITY, PARAM_EPARITY, PARAM_NOPARITY,
// or PARAM_2STOP
serFparity(PARAM_EPARITY);
// setup data bits. Either PARAM_7BIT, or PARAM_8BIT
serFdatabits(PARAM_8BIT);
// Set the Serial port mode. Used for Zworld SBC's only.
serMode(0);
return(1);
}
else return (0);
}
PARAMETER1: slave address.
PARAMETER2: baud rate (bits per second).
RETURN VALUE: 1 if successful, 0 if unsupported baud rate.
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
mmFtx <MMZ_RAB.LIB>
NOTE: MMZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void mmFtx (void)
DESCRIPTION: User defineable function for enabling the rs485
transmitter. This function is needed in your application
code. If you are doing RS232, you need only to have
an empty function like
void mmFtx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void mmFtx(void)
{
// Ensure that all the data has bent sent.
/ Turn on the RS485 transmitter by doing one the following;
// PORT: The parrallel port (PADR,PBDR,PCDR etc)
// PORTShadow: The Shadow register of the port
// ON_VALUE: 1 or 0
// PORT_BIT: parrallel port bit (0-7)
BitWrPortI(PORT,&PORTShadow, ON_VALUE, PORT_BIT);
// Or, you can do the following if your product is a Zworld SBC.
ser485Tx();
}
RETURN VALUE: none
END DESCRIPTION ******************************************************/
/*** BeginHeader */
#endif
/*** EndHeader */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -