Updated the PIC port for MS/TP. Tested on my hardware.

This commit is contained in:
skarg
2008-11-30 04:39:53 +00:00
parent a4cd23761c
commit 0b490d5440
4 changed files with 6 additions and 30 deletions
Binary file not shown.
-25
View File
@@ -77,31 +77,6 @@ void dlmstp_init(
RS485_Initialize();
MSTP_Port.InputBuffer = &Receive_Buffer.pdu[0];
MSTP_Init(&MSTP_Port);
/* FIXME: implement your data storage */
data = 64; /* I2C_Read_Byte(
EEPROM_DEVICE_ADDRESS,
EEPROM_MSTP_MAC_ADDR); */
if (data <= 127)
MSTP_Port.This_Station = data;
else
dlmstp_set_my_address(DEFAULT_MAC_ADDRESS);
/* FIXME: implement your data storage */
data = 127; /* I2C_Read_Byte(
EEPROM_DEVICE_ADDRESS,
EEPROM_MSTP_MAX_MASTER_ADDR); */
if ((data <= 127) && (data >= MSTP_Port.This_Station))
MSTP_Port.Nmax_master = data;
else
dlmstp_set_max_master(DEFAULT_MAX_MASTER);
/* FIXME: implement your data storage */
data = 1;
/* I2C_Read_Byte(
EEPROM_DEVICE_ADDRESS,
EEPROM_MSTP_MAX_INFO_FRAMES_ADDR); */
if (data >= 1)
MSTP_Port.Nmax_info_frames = data;
else
dlmstp_set_max_info_frames(DEFAULT_MAX_INFO_FRAMES);
}
void dlmstp_cleanup(
+6 -1
View File
@@ -231,7 +231,6 @@ void Initialize_Variables(
ENABLE_TIMER4_INT();
/* interrupts must be enabled before we read our inputs */
Global_Int(INT_ENABLED);
dlmstp_init();
/* Start our time from now */
Milliseconds = 0;
}
@@ -259,6 +258,12 @@ void main(
RCONbits.NOT_RI = 1;
Hardware_Initialize();
Initialize_Variables();
/* initialize BACnet Data Link Layer */
dlmstp_set_my_address(42);
dlmstp_set_max_info_frames(1);
dlmstp_set_max_master(127);
RS485_Set_Baud_Rate(38400);
dlmstp_init();
/* Handle anything that needs to be done on powerup */
/* Greet the BACnet world! */
Send_I_Am(&Handler_Transmit_Buffer[0]);
-4
View File
@@ -697,11 +697,7 @@ bool MSTP_Master_Node_FSM(
mstp_port->FrameCount = mstp_port->Nmax_info_frames;
mstp_port->master_state = MSTP_MASTER_STATE_DONE_WITH_TOKEN;
transition_now = true;
} else if (mstp_port->SilenceTimer > Tusage_delay) {
/* if we missed our timing deadline, another token will be sent */
mstp_port->master_state = MSTP_MASTER_STATE_IDLE;
} else {
/* don't send it if we are too late in getting out */
uint8_t destination = mstp_port->TxBuffer[3];
RS485_Send_Frame(mstp_port,
(uint8_t *) & mstp_port->TxBuffer[0], mstp_port->TxLength);