📄 msz_rab.lib
字号:
while (serCwrUsed() || \
BitRdPortI(SCSR,2) || \
BitRdPortI(SCSR,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.
serCrdFlush();
}
RETURN VALUE: none
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
msCtx <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void msCtx (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 msCtx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void msCtx(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 *****************************************
msDinit <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: int msDinit(unsigned qBaud)
DESCRIPTION: User function for
Initializing serial port D as a Modbus ASCII Slave.
This function must reside in your application code.
Typical code for this function would be the following;
int msDinit(unsigned qBaud)
{
// Open the serial port. THIS MUST BE DONE PRIOR TO SETTING THE
// DATA BITS AND PARITY SETTINGS.
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);
}
PARAMETER1: slave address.
PARAMETER2: baud rate (bits per second).
RETURN VALUE: 1 if successful, 0 if unsupported baud rate.
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
msDrx <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void msDrx (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 msDrx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void msDrx(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 *****************************************
msDtx <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void msDtx (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 msDtx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void msDtx(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 *****************************************
msEinit <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: int msEinit(unsigned qBaud)
DESCRIPTION: User function for
Initializing serial port E as a Modbus ASCII Slave.
This function must reside in your application code.
Typical code for this function would be the following;
int msEinit(unsigned qBaud)
{
// Open the serial port. THIS MUST BE DONE PRIOR TO SETTING THE
// DATA BITS AND PARITY SETTINGS.
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);
}
PARAMETER1: slave address.
PARAMETER2: baud rate (bits per second).
RETURN VALUE: 1 if successful, 0 if unsupported baud rate.
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
msErx <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void msErx (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 msErx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void msErx(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 *****************************************
msEtx <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void msEtx (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 msEtx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void msEtx(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 *****************************************
msFinit <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: int msFinit(unsigned qBaud)
DESCRIPTION: User function for
Initializing serial port F as a Modbus ASCII Slave.
This function must reside in your application code.
Typical code for this function would be the following;
int msFinit(unsigned qBaud)
{
// Open the serial port. THIS MUST BE DONE PRIOR TO SETTING THE
// DATA BITS AND PARITY SETTINGS.
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);
}
PARAMETER1: slave address.
PARAMETER2: baud rate (bits per second).
RETURN VALUE: 1 if successful, 0 if unsupported baud rate.
END DESCRIPTION ******************************************************/
/* START FUNCTION DESCRIPTION *****************************************
msFrx <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void msFrx (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 msFrx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void msFrx(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 *****************************************
msFtx <MSZ_RAB.LIB>
NOTE: MSZ_RAB.LIB functions are generally not reentrant.
SYNTAX: void msFtx (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 msFtx(void)
{
}
For rs485 control, you can do the following;
EXAMPLE: void msFtx(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 ******************************************************/
/*** BeginHeader */
#endif
/*** EndHeader */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -