Beispiel #1
0
void main(
    void)
{
    RCONbits.NOT_POR = 1;
    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]);
    /* Main loop */
    while (TRUE) {
        RESTART_WDT();
        dlmstp_task();
        MainTasks();
        Global_Int(INT_ENABLED);
        ENABLE_TIMER4_INT();
    }
}
//
// Setup the infrastructure, hardware, then application.
//
void setup()
{
    Timers_Initialize();

    Hardware_Initialize();

    // Start scheduler after hardware initialize
    Timers_Start();

    Application_Initialize();

    // Turn on interrupts once timers are initialized
    Hardware_EnableInterrupts();

    //
    // Initialize cloud providers
    //
    Particle_Initialize();

    Smartpux_Initialize();

    Phant_Initialize();
}