84 lines
1.9 KiB
C
84 lines
1.9 KiB
C
|
/*
|
|||
|
* can_bs2bs.c
|
|||
|
*
|
|||
|
* Created on: 27 <EFBFBD><EFBFBD><EFBFBD>. 2020 <EFBFBD>.
|
|||
|
* Author: stud
|
|||
|
*/
|
|||
|
|
|||
|
#include <281xEvTimersInit.h>
|
|||
|
#include <can_bs2bs.h>
|
|||
|
#include <edrk_main.h>
|
|||
|
#include <math.h>
|
|||
|
#include <project.h>
|
|||
|
|
|||
|
#include "control_station.h"
|
|||
|
#include "CAN_Setup.h"
|
|||
|
#include "global_time.h"
|
|||
|
#include "IQmathLib.h"
|
|||
|
#include "mathlib.h"
|
|||
|
#include "DSP281x_Examples.h" // DSP281x Examples Include File
|
|||
|
#include "DSP281x_SWPrioritizedIsrLevels.h" // DSP281x Examples Include File
|
|||
|
#include "DSP281x_Device.h"
|
|||
|
#include "xp_project.h"
|
|||
|
#include "another_bs.h"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#pragma DATA_SECTION(Unites2SecondBS, ".slow_vars")
|
|||
|
int Unites2SecondBS[SIZE_ARR_CAN_UNITES_BS2BS]={0,0,0,0,0,0,0,0,0,0,\
|
|||
|
0,0,0,0,0,0,0,0,0,0,\
|
|||
|
0,0,0,0,0,0,0,0,0,0,\
|
|||
|
0,0,0,0,0,0,0,0,0,0,\
|
|||
|
0,0,0,0,0,0,0,0,0,0\
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
|
|||
|
int max_count_send_to_can2second_bs = SIZE_ARR_CAN_UNITES_BS2BS;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void SendAll2SecondBS(unsigned int pause)
|
|||
|
{
|
|||
|
static int time_tick_modbus_can=0;
|
|||
|
static unsigned int old_PWM_ticks=0;
|
|||
|
static int count_write_to_modbus_can=0;
|
|||
|
static int time_send_to_can=0;
|
|||
|
int real_mbox, n_box;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//send to another BS
|
|||
|
if (detect_pause_milisec(pause, &old_PWM_ticks))
|
|||
|
{
|
|||
|
// if (edrk.flag_second_PCH==0)
|
|||
|
// n_box = ANOTHER_BSU2_CAN_DEVICE;
|
|||
|
// else
|
|||
|
n_box = ANOTHER_BSU1_CAN_DEVICE;
|
|||
|
|
|||
|
time_tick_modbus_can=0;
|
|||
|
time_send_to_can=0;
|
|||
|
|
|||
|
UpdateTableSecondBS();
|
|||
|
|
|||
|
real_mbox = get_real_out_mbox (UNITS_TYPE_BOX, n_box);
|
|||
|
|
|||
|
if (CAN_cycle_full_free(real_mbox,CAN_BOX_STAT_ON))
|
|||
|
{
|
|||
|
CAN_cycle_send( UNITS_TYPE_BOX, n_box, 0, &Unites2SecondBS[0], max_count_send_to_can2second_bs, CAN_BOX_STANDART_ADR, CAN_BOX_PRIORITY_NORMAL);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 40 <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|