📄 analog_values.c
字号:
temp16.BYTES.msB = U401_OCR1;
temp16.BYTES.lsB = U401_HS1;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U401 = 1;
for (temp8=0; temp8 < WAIT_100; temp8++);
ATD0CTL5 = ATD0CTL5_DJM_MASK; // ATD0 ch0, right justif., ch0 starts
while(!ATD0STAT0_SCF); // wait till conversion is completed + clear scf flag when set
fm_analog12 = ATD0DR0; // read data => clear conversion complete flags
CSB_U401 = 0; // Chipselect e-Switch MC33580 U401 - PORTB3
temp16.BYTES.msB = U401_OCR1;
temp16.BYTES.lsB = U401_NO_HS;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U401 = 1;
}
/******************************************************************************
* Module : analog_jaguar_current_hs2
* Description : measured analog value on MC33892 on HS2 Pin
* Global Data : fm_analog13
* Static Global Data: none
* Returns : none
* Arguments : none
* Special Issues : none
******************************************************************************/
void Analog_jaguar_current_hs2(void)
{
Byte temp8;
UNION16 temp16;
SPI24 temp24;
CSB_U401 = 0; // Chipselect e-Switch MC33580 U401 - PORTB3
temp16.BYTES.msB = U401_OCR1;
temp16.BYTES.lsB = U401_HS2;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U401 = 1;
for (temp8=0; temp8 < WAIT_100; temp8++);
ATD0CTL5 = ATD0CTL5_DJM_MASK; // ATD0 ch0, right justif., ch0 starts
while(!ATD0STAT0_SCF); // wait till conversion is completed + clear scf flag when set
fm_analog13 = ATD0DR0; // read data => clear conversion complete flags
CSB_U401 = 0; // Chipselect e-Switch MC33580 U401 - PORTB3
temp16.BYTES.msB = U401_OCR1;
temp16.BYTES.lsB = U401_NO_HS;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U401 = 1;
}
/******************************************************************************
* Module : analog_jaguar_current_hs3
* Description : measured analog value on MC33892 on HS3 Pin
* Global Data : fm_analog14
* Static Global Data: none
* Returns : none
* Arguments : none
* Special Issues : none
******************************************************************************/
void Analog_jaguar_current_hs3(void)
{
Byte temp8;
UNION16 temp16;
SPI24 temp24;
CSB_U401 = 0; // Chipselect e-Switch MC33580 U401 - PORTB3
temp16.BYTES.msB = U401_OCR1;
temp16.BYTES.lsB = U401_HS3;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U401 = 1;
for (temp8=0; temp8 < WAIT_100; temp8++);
ATD0CTL5 = ATD0CTL5_DJM_MASK; // ATD0 ch0, right justif., ch0 starts
while(!ATD0STAT0_SCF); // wait till conversion is completed + clear scf flag when set
fm_analog14 = ATD0DR0; // read data => clear conversion complete flags
CSB_U401 = 0; // Chipselect e-Switch MC33580 U401 - PORTB3
temp16.BYTES.msB = U401_OCR1;
temp16.BYTES.lsB = U401_NO_HS;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U401 = 1;
}
/******************************************************************************
* Module : analog_puma_temperature
* Description : measured analog value on MSDI on SP0 Pin
* Global Data : fm_analog7
* Static Global Data: none
* Returns : none
* Arguments : none
* Special Issues : none
******************************************************************************/
void Analog_puma_temperature(void)
{
Byte temp8;
UNION16 temp16;
SPI24 temp24;
for (temp8=0; temp8 < WAIT_50; temp8++);
CSB_U405 = 0;
lastmsgU405.comm = U405_ANALOG_COMMAND;
lastmsgU405.data.w = U405_ANALOG_SP0;
temp24 = ReadWriteSPI24bit(lastmsgU405);
CSB_U405 = 1;
for (temp8=0; temp8 < WAIT_100; temp8++);
ATD0CTL5 = ATD0CTL5_DJM_MASK | ATD0CTL5_CC_MASK; // ATD0 ch1, right justif., ch1 starts
while(!ATD0STAT0_SCF); // wait till conversion is completed + clear scf flag when set
fm_analog7 = ATD0DR0; // read data => clear conversion complete flags
}
/******************************************************************************
* Module : analog_puma_temperature
* Description : measured analog value on MC33580 on HS0 Pin
* Global Data : fm_analog21
* Static Global Data: none
* Returns : none
* Arguments : none
* Special Issues : none
******************************************************************************/
void Analog_puma_current_hs0(void)
{
Byte temp8;
UNION16 temp16;
SPI24 temp24;
CSB_U402 = 0; // Chipselect e-Switch MC33874 U402
temp16.BYTES.msB = U402_OCR1;
temp16.BYTES.lsB = U402_HS0;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U402 = 1;
for (temp8=0; temp8 < WAIT_100; temp8++);
ATD0CTL5 = ATD0CTL5_DJM_MASK; // ATD0 ch0, right justif., ch0 starts
while(!ATD0STAT0_SCF); // wait till conversion is completed + clear scf flag when set
fm_analog21 = ATD0DR0; // read data => clear conversion complete flags
CSB_U402 = 0; // Chipselect e-Switch MC33874 U402
temp16.BYTES.msB = U402_OCR1;
temp16.BYTES.lsB = U402_NO_HS;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U402 = 1;
}
/******************************************************************************
* Module : analog_puma_current_hs1
* Description : measured analog value on MC33580 on HS1 Pin
* Global Data : fm_analog22
* Static Global Data: none
* Returns : none
* Arguments : none
* Special Issues : none
******************************************************************************/
void Analog_puma_current_hs1(void)
{
Byte temp8;
UNION16 temp16;
SPI24 temp24;
CSB_U402 = 0; // Chipselect e-Switch MC33874 U402
temp16.BYTES.msB = U402_OCR1;
temp16.BYTES.lsB = U402_HS1;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U402 = 1;
for (temp8=0; temp8 < WAIT_100; temp8++);
ATD0CTL5 = ATD0CTL5_DJM_MASK; // ATD0 ch0, right justif., ch0 starts
while(!ATD0STAT0_SCF); // wait till conversion is completed + clear scf flag when set
fm_analog22 = ATD0DR0; // read data => clear conversion complete flags
CSB_U402 = 0; // Chipselect e-Switch MC33874 U402
temp16.BYTES.msB = U402_OCR1;
temp16.BYTES.lsB = U402_NO_HS;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U402 = 1;
}
/******************************************************************************
* Module : analog_puma_current_hs2
* Description : measured analog value on MC33580 on HS2 Pin
* Global Data : fm_analog23
* Static Global Data: none
* Returns : none
* Arguments : none
* Special Issues : none
******************************************************************************/
void Analog_puma_curent_hs2(void)
{
Byte temp8;
UNION16 temp16;
SPI24 temp24;
CSB_U402 = 0; // Chipselect e-Switch MC33874 U402
temp16.BYTES.msB = U402_OCR1;
temp16.BYTES.lsB = U402_HS2;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U402 = 1;
for (temp8=0; temp8 < WAIT_100; temp8++);
ATD0CTL5 = ATD0CTL5_DJM_MASK; // ATD0 ch0, right justif., ch0 starts
while(!ATD0STAT0_SCF); // wait till conversion is completed + clear scf flag when set
fm_analog23 = ATD0DR0; // read data => clear conversion complete flags
CSB_U402 = 0; // Chipselect e-Switch MC33874 U402
temp16.BYTES.msB = U402_OCR1;
temp16.BYTES.lsB = U402_NO_HS;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U402 = 1;
}
/******************************************************************************
* Module : analog_puma_current_hs3
* Description : measured analog value on MC33580 on HS3 Pin
* Global Data : fm_analog24
* Static Global Data: none
* Returns : none
* Arguments : none
* Special Issues : none
******************************************************************************/
void Analog_puma_current_hs3(void)
{
Byte temp8;
UNION16 temp16;
SPI24 temp24;
CSB_U402 = 0; // Chipselect e-Switch MC33874 U402
temp16.BYTES.msB = U402_OCR1;
temp16.BYTES.lsB = U402_HS3;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U402 = 1;
for (temp8=0; temp8 < WAIT_100; temp8++);
ATD0CTL5 = ATD0CTL5_DJM_MASK; // ATD0 ch0, right justif., ch0 starts
while(!ATD0STAT0_SCF); // wait till conversion is completed + clear scf flag when set
fm_analog24 = ATD0DR0; // read data => clear conversion complete flags
CSB_U402 = 0; // Chipselect e-Switch MC33874 U402
temp16.BYTES.msB = U402_OCR1;
temp16.BYTES.lsB = U402_NO_HS;
temp16 = ReadWriteSPI16bit(temp16);
CSB_U402 = 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -