Hello
i have compiled the bacnet stack on the PIC18 . All is going well and the device is discovered in the network.Would it be possible to set the object instance number of the device from the network as we don't have a dip switch setting in our board.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have created devices without DIP switch or user interface, and have all their properties set from BACnet network.
In the example PIC project (bacnet-stack/ports/pic18f6720), in the device.c module, you might have noticed that PROP_OBJECT_IDENTIFIER is a writable property, and sets the Device ID (object instance number of the device object). There is a comment in the function Device_Set_Object_Instance_Number() which says "FIXME: Write the data to the eeprom" to make sure the Device ID is persistent. You could write there, or from another part of the code which could read the Device_Object_Instance_Number() and if it changes, save it to EEPROM or flash or somewhere non-volatile for use when power up occurs.
Other vendors I have talked to have done a similar thing, but used an Analog Value object present-value property for this purpose.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did as you said and it worked. But I noticed a range of 0-100 which is writable through analog value object. should I adjust that range according to my requirement??? If not,what should I do for a higher range value??
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The example PIC analog value object (in ports/pic18f6720/av.c module) uses a byte (uint8_t) data type to store the present-value property, rather than a float as specified by BACnet. That example simply casts the byte to a float before returning the value requested. Likewise, when the value is written, it is checked to see if it fits in the data storage:
You can and should modify the av.c for your needs. If you prefer to use a larger range, you can simply change the datatype to float and remove the checks for data range in the write.
There are other example objects in bacnet-stack\demo\object directory. If your application has a float input value, then an analog-input object is probably a better choice. If your application has a float output value, then an analog-output object is a better choice. Each object type defined in BACnet is available for modeling your particular product.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the reply.
Can i use Binary Value object for reading the binary values from the network.
i didn't see any set function for the binary value to set.i just want to show my start up binary default value in the network.Any issues in adding the set function in Binary Value object?????
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
i have compiled the bacnet stack on the PIC18 . All is going well and the device is discovered in the network.Would it be possible to set the object instance number of the device from the network as we don't have a dip switch setting in our board.
I have created devices without DIP switch or user interface, and have all their properties set from BACnet network.
In the example PIC project (bacnet-stack/ports/pic18f6720), in the device.c module, you might have noticed that PROP_OBJECT_IDENTIFIER is a writable property, and sets the Device ID (object instance number of the device object). There is a comment in the function Device_Set_Object_Instance_Number() which says "FIXME: Write the data to the eeprom" to make sure the Device ID is persistent. You could write there, or from another part of the code which could read the Device_Object_Instance_Number() and if it changes, save it to EEPROM or flash or somewhere non-volatile for use when power up occurs.
Other vendors I have talked to have done a similar thing, but used an Analog Value object present-value property for this purpose.
Thanks for reply
I did as you said and it worked. But I noticed a range of 0-100 which is writable through analog value object. should I adjust that range according to my requirement??? If not,what should I do for a higher range value??
The example PIC analog value object (in ports/pic18f6720/av.c module) uses a byte (uint8_t) data type to store the present-value property, rather than a float as specified by BACnet. That example simply casts the byte to a float before returning the value requested. Likewise, when the value is written, it is checked to see if it fits in the data storage:
You can and should modify the av.c for your needs. If you prefer to use a larger range, you can simply change the datatype to float and remove the checks for data range in the write.
There are other example objects in bacnet-stack\demo\object directory. If your application has a float input value, then an analog-input object is probably a better choice. If your application has a float output value, then an analog-output object is a better choice. Each object type defined in BACnet is available for modeling your particular product.
Thanks for the reply.
Can i use Binary Value object for reading the binary values from the network.
i didn't see any set function for the binary value to set.i just want to show my start up binary default value in the network.Any issues in adding the set function in Binary Value object?????
At the moment, there is not any set function for Binary Value object, but it can be easily added.
Some example API for objects can be found in bacnet-stack/demo/object/ header files, and inside the bv.h file there could be (similar to bo.h):
Just add those to bv.h header file (or copy bv.h to your local port directory and modify), and then implement a function for those inside bv.c file.
Someday we'll add all the possible API and BACnet features, but it takes free time to complete it.