Updated code to compile on MPLAB C18 v2.44 compiler.
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ int Analog_Input_Encode_Property_APDU(
|
||||
break;
|
||||
case PROP_OBJECT_NAME:
|
||||
case PROP_DESCRIPTION:
|
||||
sprintf(text_string,"ANALOG INPUT %d",object_instance);
|
||||
sprintf(text_string,"ANALOG INPUT %u",object_instance);
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], text_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ int Analog_Output_Encode_Property_APDU(
|
||||
case PROP_OBJECT_NAME:
|
||||
case PROP_DESCRIPTION:
|
||||
// note: the object name must be unique within this device
|
||||
sprintf(text_string,"ANALOG OUTPUT %d",object_instance);
|
||||
sprintf(text_string,"ANALOG OUTPUT %u",object_instance);
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], text_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
// This is used in constructing messages and to tell others our limits
|
||||
// 50 is the minimum; adjust to your memory and physical layer constraints
|
||||
// Lon=206, MS/TP=480, ARCNET=480, Ethernet=1476
|
||||
//#define MAX_APDU 50
|
||||
#define MAX_APDU 480
|
||||
#define MAX_APDU 50
|
||||
//#define MAX_APDU 480
|
||||
//#define MAX_APDU 1476
|
||||
|
||||
// for confirmed messages, this is the number of transactions
|
||||
|
||||
@@ -31,8 +31,10 @@
|
||||
#include "config.h" // the custom stuff
|
||||
#include "ai.h" // object list dependency
|
||||
#include "ao.h" // object list dependency
|
||||
#include "bacfile.h" // object list dependency
|
||||
#include "wp.h" // write property handling
|
||||
#if BACFILE
|
||||
#include "bacfile.h" // object list dependency
|
||||
#endif
|
||||
|
||||
static uint32_t Object_Instance_Number = 0;
|
||||
// FIXME: it is likely that this name is configurable,
|
||||
@@ -229,7 +231,9 @@ unsigned Device_Object_List_Count(void)
|
||||
|
||||
count += Analog_Input_Count();
|
||||
count += Analog_Output_Count();
|
||||
#if BACFILE
|
||||
count += bacfile_count();
|
||||
#endif
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -270,6 +274,7 @@ bool Device_Object_List_Identifier(unsigned array_index,
|
||||
}
|
||||
}
|
||||
|
||||
#if BACFILE
|
||||
if (!status)
|
||||
{
|
||||
object_index -= Analog_Output_Count();
|
||||
@@ -280,6 +285,7 @@ bool Device_Object_List_Identifier(unsigned array_index,
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,16 @@
|
||||
#include "mstp.h"
|
||||
#include "dlmstp.h"
|
||||
|
||||
void dlmstp_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void dlmstp_cleanup(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* returns number of bytes sent on success, negative on failure */
|
||||
int dlmstp_send_pdu(
|
||||
BACNET_ADDRESS *dest, // destination address
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void dlmstp_init(void);
|
||||
void dlmstp_cleanup(void);
|
||||
|
||||
/* returns number of bytes sent on success, negative on failure */
|
||||
int dlmstp_send_pdu(
|
||||
BACNET_ADDRESS *dest, // destination address
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "rp.h"
|
||||
#include "wp.h"
|
||||
#include "arf.h"
|
||||
#include "bacfile.h"
|
||||
#include "whois.h"
|
||||
#include "iam.h"
|
||||
#include "reject.h"
|
||||
@@ -47,7 +46,9 @@
|
||||
#include "address.h"
|
||||
#include "tsm.h"
|
||||
#include "datalink.h"
|
||||
|
||||
#if BACFILE
|
||||
#include "bacfile.h"
|
||||
#endif
|
||||
// Example handlers of services
|
||||
|
||||
// flag to send an I-Am
|
||||
@@ -397,6 +398,7 @@ void ReadPropertyHandler(
|
||||
else
|
||||
error = true;
|
||||
break;
|
||||
#if BACFILE
|
||||
case OBJECT_FILE:
|
||||
if (bacfile_valid_instance(data.object_instance))
|
||||
{
|
||||
@@ -426,6 +428,7 @@ void ReadPropertyHandler(
|
||||
else
|
||||
error = true;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
error = true;
|
||||
break;
|
||||
@@ -585,6 +588,7 @@ void WritePropertyHandler(
|
||||
return;
|
||||
}
|
||||
|
||||
#if BACFILE
|
||||
void AtomicReadFileHandler(
|
||||
uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
@@ -700,7 +704,9 @@ void AtomicReadFileHandler(
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BACFILE
|
||||
// We performed an AtomicReadFile Request,
|
||||
// and here is the data from the server
|
||||
// Note: it does not have to be the same file=instance
|
||||
@@ -754,6 +760,6 @@ void AtomicReadFileAckHandler(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ dir_src=
|
||||
dir_bin=
|
||||
dir_tmp=
|
||||
dir_sin=
|
||||
dir_inc=D:\mcc18\h;\bacnet-stack;\bacnet-stack\ports\pic18
|
||||
dir_lib=D:\mcc18\lib
|
||||
dir_inc=c:\mcc18\h;c:\code\bacnet-stack;c:\code\bacnet-stack\ports\pic18
|
||||
dir_lib=c:\mcc18\lib
|
||||
dir_lkr=
|
||||
[CAT_FILTERS]
|
||||
filter_src=*.asm;*.c
|
||||
@@ -62,72 +62,83 @@ file_042=no
|
||||
file_043=no
|
||||
file_044=no
|
||||
file_045=no
|
||||
file_046=no
|
||||
file_047=no
|
||||
file_048=no
|
||||
file_049=no
|
||||
file_050=no
|
||||
file_051=no
|
||||
file_052=no
|
||||
file_053=no
|
||||
[FILE_INFO]
|
||||
file_000=rs485.c
|
||||
file_001=D:\bacnet-stack\whois.c
|
||||
file_002=D:\bacnet-stack\apdu.c
|
||||
file_003=D:\bacnet-stack\bacdcode.c
|
||||
file_004=D:\bacnet-stack\bacerror.c
|
||||
file_005=D:\bacnet-stack\bigend.c
|
||||
file_006=D:\bacnet-stack\crc.c
|
||||
file_007=D:\bacnet-stack\device.c
|
||||
file_008=D:\bacnet-stack\iam.c
|
||||
file_009=D:\bacnet-stack\mstp.c
|
||||
file_010=D:\bacnet-stack\npdu.c
|
||||
file_011=D:\bacnet-stack\reject.c
|
||||
file_012=D:\bacnet-stack\ringbuf.c
|
||||
file_013=D:\bacnet-stack\rp.c
|
||||
file_014=D:\bacnet-stack\abort.c
|
||||
file_015=D:\bacnet-stack\wp.c
|
||||
file_016=main.c
|
||||
file_017=init.c
|
||||
file_018=isr.c
|
||||
file_019=timer.c
|
||||
file_020=stdbool.h
|
||||
file_021=stdint.h
|
||||
file_022=D:\bacnet-stack\wp.h
|
||||
file_023=D:\bacnet-stack\apdu.h
|
||||
file_024=D:\bacnet-stack\bacdcode.h
|
||||
file_025=D:\bacnet-stack\bacdef.h
|
||||
file_026=D:\bacnet-stack\bacenum.h
|
||||
file_027=D:\bacnet-stack\bacerror.h
|
||||
file_028=D:\bacnet-stack\bigend.h
|
||||
file_029=D:\bacnet-stack\bits.h
|
||||
file_030=D:\bacnet-stack\bytes.h
|
||||
file_031=D:\bacnet-stack\config.h
|
||||
file_032=D:\bacnet-stack\crc.h
|
||||
file_033=D:\bacnet-stack\device.h
|
||||
file_034=D:\bacnet-stack\iam.h
|
||||
file_035=D:\bacnet-stack\mstp.h
|
||||
file_036=D:\bacnet-stack\npdu.h
|
||||
file_037=D:\bacnet-stack\reject.h
|
||||
file_038=D:\bacnet-stack\ringbuf.h
|
||||
file_039=D:\bacnet-stack\rp.h
|
||||
file_040=D:\bacnet-stack\rs485.h
|
||||
file_041=D:\bacnet-stack\whois.h
|
||||
file_042=D:\bacnet-stack\abort.h
|
||||
file_043=init.h
|
||||
file_044=timer.h
|
||||
file_045=18f252.lkr
|
||||
file_001=main.c
|
||||
file_002=init.c
|
||||
file_003=isr.c
|
||||
file_004=timer.c
|
||||
file_005=C:\code\bacnet-stack\rp.c
|
||||
file_006=C:\code\bacnet-stack\whois.c
|
||||
file_007=C:\code\bacnet-stack\abort.c
|
||||
file_008=C:\code\bacnet-stack\apdu.c
|
||||
file_009=C:\code\bacnet-stack\bacdcode.c
|
||||
file_010=C:\code\bacnet-stack\bacerror.c
|
||||
file_011=C:\code\bacnet-stack\bigend.c
|
||||
file_012=C:\code\bacnet-stack\crc.c
|
||||
file_013=C:\code\bacnet-stack\datalink.c
|
||||
file_014=C:\code\bacnet-stack\device.c
|
||||
file_015=C:\code\bacnet-stack\dlmstp.c
|
||||
file_016=C:\code\bacnet-stack\iam.c
|
||||
file_017=C:\code\bacnet-stack\mstp.c
|
||||
file_018=C:\code\bacnet-stack\npdu.c
|
||||
file_019=C:\code\bacnet-stack\reject.c
|
||||
file_020=C:\code\bacnet-stack\ringbuf.c
|
||||
file_021=C:\code\bacnet-stack\address.c
|
||||
file_022=C:\code\bacnet-stack\tsm.c
|
||||
file_023=C:\code\bacnet-stack\ao.c
|
||||
file_024=C:\code\bacnet-stack\ai.c
|
||||
file_025=C:\code\bacnet-stack\handlers.c
|
||||
file_026=C:\code\bacnet-stack\wp.c
|
||||
file_027=stdbool.h
|
||||
file_028=stdint.h
|
||||
file_029=init.h
|
||||
file_030=timer.h
|
||||
file_031=C:\code\bacnet-stack\tsm.h
|
||||
file_032=C:\code\bacnet-stack\whois.h
|
||||
file_033=C:\code\bacnet-stack\abort.h
|
||||
file_034=C:\code\bacnet-stack\address.h
|
||||
file_035=C:\code\bacnet-stack\apdu.h
|
||||
file_036=C:\code\bacnet-stack\bacdcode.h
|
||||
file_037=C:\code\bacnet-stack\bacdef.h
|
||||
file_038=C:\code\bacnet-stack\bacenum.h
|
||||
file_039=C:\code\bacnet-stack\bacerror.h
|
||||
file_040=C:\code\bacnet-stack\bigend.h
|
||||
file_041=C:\code\bacnet-stack\bits.h
|
||||
file_042=C:\code\bacnet-stack\bytes.h
|
||||
file_043=C:\code\bacnet-stack\config.h
|
||||
file_044=C:\code\bacnet-stack\crc.h
|
||||
file_045=C:\code\bacnet-stack\datalink.h
|
||||
file_046=C:\code\bacnet-stack\device.h
|
||||
file_047=C:\code\bacnet-stack\dlmstp.h
|
||||
file_048=C:\code\bacnet-stack\mstp.h
|
||||
file_049=C:\code\bacnet-stack\npdu.h
|
||||
file_050=C:\code\bacnet-stack\reject.h
|
||||
file_051=C:\code\bacnet-stack\ringbuf.h
|
||||
file_052=C:\code\bacnet-stack\rs485.h
|
||||
file_053=18f252.lkr
|
||||
[SUITE_INFO]
|
||||
suite_guid={5B7D72DD-9861-47BD-9F60-2BE967BF8416}
|
||||
suite_state=
|
||||
[TOOL_SETTINGS]
|
||||
TS{DD2213A8-6310-47B1-8376-9430CDFC013F}=
|
||||
TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}=/m"$(BINDIR_)$(TARGETBASE).map" /o"$(TARGETBASE).cof"
|
||||
TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}=
|
||||
TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}=-DBACDL_MSTP
|
||||
TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}=
|
||||
TS{DD2213A8-6310-47B1-8376-9430CDFC013F}009=
|
||||
TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}009=/o"$(TARGETBASE).cof"
|
||||
TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}009=-Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
|
||||
TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}009=
|
||||
TS{DD2213A8-6310-47B1-8376-9430CDFC013F}016=
|
||||
TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}016=/o"$(TARGETBASE).cof"
|
||||
TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}016=-Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
|
||||
TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}016=
|
||||
TS{DD2213A8-6310-47B1-8376-9430CDFC013F}001=
|
||||
TS{BFD27FBA-4A02-4C0E-A5E5-B812F3E7707C}001=/o"$(TARGETBASE).cof"
|
||||
TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}001=-Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
|
||||
TS{ADE93A55-C7C7-4D4D-A4BA-59305F7D0391}001=
|
||||
[ACTIVE_FILE_SETTINGS]
|
||||
TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}009_active=yes
|
||||
TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}016_active=yes
|
||||
TS{C2AF05E7-1416-4625-923D-E114DB6E2B96}001_active=yes
|
||||
[TOOL_LOC_STAMPS]
|
||||
tool_loc{96C98149-AA1B-4CF9-B967-FAE79CAB663C}=D:\mcc18\bin\mplink.exe
|
||||
tool_loc{E56A1C86-9D32-4DF6-8C34-FE0388B1B644}=D:\mcc18\bin\mcc18.exe
|
||||
tool_loc{96C98149-AA1B-4CF9-B967-FAE79CAB663C}=C:\mcc18\bin\mplink.exe
|
||||
tool_loc{E56A1C86-9D32-4DF6-8C34-FE0388B1B644}=C:\mcc18\bin\mcc18.exe
|
||||
|
||||
Binary file not shown.
@@ -29,38 +29,43 @@
|
||||
#include <stdint.h>
|
||||
#include "hardware.h"
|
||||
|
||||
// define this to enable ICD - debugger
|
||||
//#define USE_ICD
|
||||
// ------------------------- Configuration Bits ----------------------------
|
||||
#pragma romdata CONFIG
|
||||
#ifdef USE_ICD
|
||||
_CONFIG_DECL (
|
||||
_CONFIG1H_DEFAULT & _OSCS_OFF_1H & _OSC_HS_1H,
|
||||
_CONFIG2L_DEFAULT & _BOR_ON_2L & _BORV_27_2L & _PWRT_ON_2L,
|
||||
_CONFIG2H_DEFAULT & _WDT_OFF_2H & _WDTPS_128_2H,
|
||||
_CONFIG3H_DEFAULT & _CCP2MUX_OFF_3H,
|
||||
_CONFIG4L_DEFAULT & _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_ON_4L,
|
||||
_CONFIG5L_DEFAULT & _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L ,
|
||||
_CONFIG5H_DEFAULT & _CPB_OFF_5H & _CPD_OFF_5H,
|
||||
_CONFIG6L_DEFAULT & _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L ,
|
||||
_CONFIG6H_DEFAULT & _WPC_OFF_6H & _WPB_OFF_6H & _WPD_OFF_6H,
|
||||
_CONFIG7L_DEFAULT & _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L,
|
||||
_CONFIG7H_DEFAULT & _EBTRB_OFF_7H);
|
||||
#else
|
||||
_CONFIG_DECL (
|
||||
_CONFIG1H_DEFAULT & _OSCS_OFF_1H & _OSC_HS_1H,
|
||||
_CONFIG2L_DEFAULT & _BOR_ON_2L & _BORV_27_2L & _PWRT_ON_2L,
|
||||
_CONFIG2H_DEFAULT & _WDT_ON_2H & _WDTPS_128_2H,
|
||||
_CONFIG3H_DEFAULT & _CCP2MUX_OFF_3H,
|
||||
_CONFIG4L_DEFAULT & _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L,
|
||||
_CONFIG5L_DEFAULT & _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L ,
|
||||
_CONFIG5H_DEFAULT & _CPB_OFF_5H & _CPD_OFF_5H,
|
||||
_CONFIG6L_DEFAULT & _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L ,
|
||||
_CONFIG6H_DEFAULT & _WPC_OFF_6H & _WPB_OFF_6H & _WPD_OFF_6H,
|
||||
_CONFIG7L_DEFAULT & _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L,
|
||||
_CONFIG7H_DEFAULT & _EBTRB_OFF_7H);
|
||||
// define this to enable ICD
|
||||
//#define USE_ICD
|
||||
|
||||
// Configuration Bits
|
||||
#pragma config OSC = HS
|
||||
#pragma config PWRT = ON
|
||||
#pragma config BOR = ON, BORV = 42
|
||||
#pragma config CCP2MUX = ON
|
||||
#pragma config STVR = ON
|
||||
#pragma config LVP = OFF
|
||||
#pragma config CP0 = OFF
|
||||
#pragma config CP1 = OFF
|
||||
#pragma config CP2 = OFF
|
||||
#pragma config CP3 = OFF
|
||||
#pragma config CPB = OFF
|
||||
#pragma config CPD = OFF
|
||||
#pragma config WRT0 = OFF
|
||||
#pragma config WRT1 = OFF
|
||||
#pragma config WRT2 = OFF
|
||||
#pragma config WRT3 = OFF
|
||||
#pragma config WRTB = OFF
|
||||
#pragma config WRTC = OFF
|
||||
#pragma config WRTD = OFF
|
||||
#pragma config EBTR0 = OFF
|
||||
#pragma config EBTR1 = OFF
|
||||
#pragma config EBTR2 = OFF
|
||||
#pragma config EBTR3 = OFF
|
||||
#pragma config EBTRB = OFF
|
||||
|
||||
#ifdef USE_ICD
|
||||
#pragma config WDT = OFF, WDTPS = 128
|
||||
#pragma config DEBUG = ON
|
||||
#else
|
||||
#pragma config WDT = ON, WDTPS = 128
|
||||
#pragma config DEBUG = OFF
|
||||
#endif /* USE_ICD */
|
||||
|
||||
#endif // USE_ICD
|
||||
#pragma romdata
|
||||
|
||||
/****************************************************************************
|
||||
@@ -123,4 +128,4 @@ void init_hardware(void)
|
||||
// Turn on the Zero cross interrupt
|
||||
INTCONbits.INT0F = 0;
|
||||
INTCONbits.INT0E = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ static void Check_Timer_Milliseconds(void)
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
void main(void)
|
||||
{
|
||||
init_hardware();
|
||||
RS485_Initialize();
|
||||
@@ -81,5 +81,5 @@ int main(void)
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h> // memmove()
|
||||
#include <assert.h>
|
||||
#include "bits.h"
|
||||
#include "apdu.h"
|
||||
#include "bacdef.h"
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ typedef enum
|
||||
TSM_STATE_AWAIT_CONFIRMATION,
|
||||
TSM_STATE_AWAIT_RESPONSE,
|
||||
TSM_STATE_SEGMENTED_REQUEST,
|
||||
TSM_STATE_SEGMENTED_CONFIRMATION,
|
||||
TSM_STATE_SEGMENTED_CONFIRMATION
|
||||
} BACNET_TSM_STATE;
|
||||
|
||||
// 5.4.1 Variables And Parameters
|
||||
|
||||
Reference in New Issue
Block a user