Corrected compile errors in PIC port for MS/TP. Untested.

This commit is contained in:
skarg
2008-11-28 22:05:46 +00:00
parent 63f3f77552
commit 1ad2da7895
4 changed files with 47 additions and 40 deletions
+26 -22
View File
@@ -83,6 +83,7 @@ file_056=.
file_057=.
file_058=.
file_059=.
file_060=.
[GENERATED_FILES]
file_000=no
file_001=no
@@ -144,6 +145,7 @@ file_056=no
file_057=no
file_058=no
file_059=no
file_060=no
[OTHER_FILES]
file_000=no
file_001=no
@@ -205,6 +207,7 @@ file_056=no
file_057=no
file_058=no
file_059=no
file_060=no
[FILE_INFO]
file_000=C:\code\bacnet-stack\src\abort.c
file_001=C:\code\bacnet-stack\src\bacapp.c
@@ -244,28 +247,29 @@ file_034=C:\code\bacnet-stack\src\npdu.c
file_035=C:\code\bacnet-stack\src\version.c
file_036=apdu.c
file_037=C:\code\bacnet-stack\demo\handler\noserv.c
file_038=stdbool.h
file_039=stdint.h
file_040=rs485.h
file_041=mstp.h
file_042=C:\mcc18\h\p18f6720.h
file_043=C:\code\bacnet-stack\include\bits.h
file_044=C:\code\bacnet-stack\include\abort.h
file_045=C:\code\bacnet-stack\include\ai.h
file_046=C:\code\bacnet-stack\include\apdu.h
file_047=C:\code\bacnet-stack\include\bacaddr.h
file_048=C:\code\bacnet-stack\include\bacapp.h
file_049=C:\code\bacnet-stack\include\bacdcode.h
file_050=C:\code\bacnet-stack\include\bacdef.h
file_051=C:\code\bacnet-stack\include\bacenum.h
file_052=C:\code\bacnet-stack\include\bacerror.h
file_053=C:\code\bacnet-stack\include\bacint.h
file_054=C:\code\bacnet-stack\include\bacprop.h
file_055=C:\code\bacnet-stack\include\bacreal.h
file_056=C:\code\bacnet-stack\include\bacstr.h
file_057=C:\code\bacnet-stack\include\bigend.h
file_058=C:\code\bacnet-stack\include\config.h
file_059=18F6720.lkr
file_038=C:\code\bacnet-stack\src\fifo.c
file_039=stdbool.h
file_040=stdint.h
file_041=rs485.h
file_042=mstp.h
file_043=C:\mcc18\h\p18f6720.h
file_044=C:\code\bacnet-stack\include\bits.h
file_045=C:\code\bacnet-stack\include\abort.h
file_046=C:\code\bacnet-stack\include\ai.h
file_047=C:\code\bacnet-stack\include\apdu.h
file_048=C:\code\bacnet-stack\include\bacaddr.h
file_049=C:\code\bacnet-stack\include\bacapp.h
file_050=C:\code\bacnet-stack\include\bacdcode.h
file_051=C:\code\bacnet-stack\include\bacdef.h
file_052=C:\code\bacnet-stack\include\bacenum.h
file_053=C:\code\bacnet-stack\include\bacerror.h
file_054=C:\code\bacnet-stack\include\bacint.h
file_055=C:\code\bacnet-stack\include\bacprop.h
file_056=C:\code\bacnet-stack\include\bacreal.h
file_057=C:\code\bacnet-stack\include\bacstr.h
file_058=C:\code\bacnet-stack\include\bigend.h
file_059=C:\code\bacnet-stack\include\config.h
file_060=18F6720.lkr
[SUITE_INFO]
suite_guid={5B7D72DD-9861-47BD-9F60-2BE967BF8416}
suite_state=
Binary file not shown.
+19 -17
View File
@@ -41,14 +41,15 @@ extern volatile struct mstp_port_struct_t MSTP_Port;
/* the baud rate is adjustable */
uint32_t RS485_Baud_Rate = 38400;
/*#pragma udata MSTPPortData
*/
/* the FIFO structures for sending and receiving */
FIFO_BUFFER FIFO_Rx;
FIFO_BUFFER FIFO_Tx;
#pragma udata MSTPPortData
/* the buffer for receiving data (size must be a power of 2) */
volatile uint8_t RS485_Rx_Buffer[128];
FIFO_BUFFER FIFO_Rx;
/* the buffer for sending data (size must be a power of 2) */
volatile uint8_t RS485_Tx_Buffer[128];
FIFO_BUFFER FIFO_Tx;
#pragma udata
/****************************************************************************
* DESCRIPTION: Transmits a frame using the UART
@@ -67,7 +68,7 @@ void RS485_Send_Frame(
if (!buffer)
return;
while (!Empty(&FIFO_Tx)) {
while (!FIFO_Empty(&FIFO_Tx)) {
/* buffer is not empty. Wait for ISR to transmit. */
};
@@ -83,18 +84,19 @@ void RS485_Send_Frame(
/* The line has not been silent long enough, so wait. */
};
FIFO_Add(&FIFO_Tx, buffer, nbytes);
/* disable the receiver */
PIE3bits.RC2IE = 0;
RCSTA2bits.CREN = 0;
/* enable the transceiver */
RS485_TX_ENABLE = 1;
RS485_RX_DISABLE = 1;
/* enable the transmitter */
TXSTA2bits.TXEN = 1;
PIE3bits.TX2IE = 1;
/* reset the silence timer per MSTP spec, sort of */
mstp_port->SilenceTimer = 0;
if (FIFO_Add(&FIFO_Tx, buffer, nbytes)) {
/* disable the receiver */
PIE3bits.RC2IE = 0;
RCSTA2bits.CREN = 0;
/* enable the transceiver */
RS485_TX_ENABLE = 1;
RS485_RX_DISABLE = 1;
/* enable the transmitter */
TXSTA2bits.TXEN = 1;
PIE3bits.TX2IE = 1;
/* reset the silence timer per MSTP spec, sort of */
mstp_port->SilenceTimer = 0;
}
return;
}
+2 -1
View File
@@ -164,8 +164,9 @@ bool FIFO_Add(
/* limit the ring to prevent overwriting */
if (FIFO_Available (b, count)) {
while (count) {
b->buffer[b->head % b->buffer_len] = data_byte;
b->buffer[b->head % b->buffer_len] = *data_bytes;
b->head++;
data_bytes++;
count--;
}
status = true;