Sie sind auf Seite 1von 6

Declarations for Digital Outputs :

Schematic Net
VARIABLE NAME
Name
GRN_LED1
PILOT_LIGHT
GRN_LED2
OPER_OK
GRN_LED3
BAT_GOOD
RED_LED1
BAT_ERR
RED_LED2
WARNING_LIGHT
RED_LED3
HIGH_TEMP_ALRM
1V5_EN
1V5_EN
PILOT_RELIGHT
PILOT_RELIGHT
ALARM
ALARM
HIGH_MAIN_VALVE HM_VALVE
LOW_MAIN_VALVE LM_VALVE

uC Port
ID
RC0
RC1
RC2
RB3
RB4
RB5
RE7
RD4
RD2
RD1
RD0

Declarations for Analog Inputs :


Schematic Net
VARIABLE NAME
Name
NTC_TEMP+
NTC_TEMP

uC Port Analog
ID
Input
RA0
AN0

VBAT_CUR_SEN
VBAT_VMON

RA1
RA5

VBAT_CUR
VBAT_VOLT

Declarations for I2C Devices :


I2C Device
VARIABLE NAME

Active
State
HIGH
HIGH
HIGH
HIGH
HIGH
HIGH
HIGH
HIGH
HIGH
HIGH
HIGH

AN1
AN4

Voltage Conversion
Voltage divider - See chart provided
(ThermoMatrix_10K_Sensor)
110mV/A
Voltage Divider - 20% of VBAT voltage

I2C Port

MMA7660FCR1

ACCL

I2C
Address
SDA2/SCL2 0x4C

Functional Description

MCP4725A0T

THERM_OUT

SDA2/SCL2 0x60

See table on page 28 of


datasheet we are detecting if
we are tilted more than 15C
away from horizontal
Do not implement currently

Declarations for SPI Devices :


SPI Device
VARIABLE NAME

SPI Port

Functional Description

MAX31855KASA+

THERM_IN

SPI1

Chip
Select Pin
RG0

MAX31865ATP+

RTD_IN

SPI1

RG4

See table on page 10 of the


datasheet. SPI values will be the
temperature currently being
read (0 to 250C is the range we
will be using)
See table below in this
document for setup information

Setup for MAX31865ATP+ device (RTD_IN):


Register
Register Address Desired
(write/read)
Register Value
Configuration
80h/00h
C2h
Register
RTD MSBs
NA / 01h
Read only
RTD LSBs

NA / 02h

Read only

UART variables (read and write):


UART Variable
VARIABLE NAME
1.5V Power Supply
1V5_EN
Pilot Relight
PILOT_RELIGHT
ALARM
ALARM
High Main Valve
HM_VALVE
Low Main Valve
LM_VALVE
Accelerometer X
ACCL_X
Accelerometer Y
ACCL_Y
Accelerometer Z
ACCL_Z
Angle Limit
ANG_LIM
Angle Reset
ANG_RST
Delta Temperature
DELTA_T
Thermocouple IN
THERM_IN
(SPI - MAX31855)
Thermocouple IN
THERM_IN_MIN
MIN
Thermocouple IN
THERM_IN_MAX
MAX
RTD Temperature IN RTD_IN
(SPI - MAX31865)
RTD Temperature
RTD_IN_MIN
MIN
RTD Temperature
RTD_IN_MAX
MAX
Thermistor
NTC_TEMP
Temperature IN
Thermistor
NTC_TEMP_MIN
Temperature MIN
Thermistor
NTC_TEMP_MAX
Temperature MAX
Battery Voltage
VBAT_VMON
Battery Warning
VBAT_WARN
Battery Current
VBAT_CUR

Description
VBIAS On, Automatic Mode, 2-wire RTD, 60Hz
filter selected
Read back the MSBs of the RTD resistance
value (see page 14 of the datasheet)
Read back the LSBs of the RTD resistance value
(see page 14 of the datasheet)

Read?
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

Range
On/Off
On/Off
On/Off
On/Off
On/Off
-1g to 1g
-1g to 1g
-1g to 1g
Default: 0.281g
Default: 0.141g
Default: 200C
0-1000C

Write?
No
No
No
No
No
No
No
No
Yes
Yes
Yes
No

Range

Yes

Default: 250mV

Yes

250mV 750mV

Yes

Default: 750mV

Yes

250mV 750mV

Yes

0-250C

No

Yes

Default: 190C

Yes

150C - 250C

Yes

Default: 210C

Yes

150C - 250C

Yes

-20C - 105C

No

Yes

Default: 60C

Yes

40C - 90C

Yes

Default: 80C

Yes

40C - 90C

Yes
Yes
Yes

0V 15V
Default: 10V
-2A to 12A

No
Yes
No

0V to 15V

0g to 1g
0g to 1g
0C to 250C

General Description
The controller will be, after power on, stuck in a constant loop checking digital inputs and sensor values.
Based on these values, the controller will perform certain functions.
At the beginning of each loop, the controller will check the accelerometer to confirm that the board is
not mounted incorrectly (it needs to be placed on a flat surface +/-15C). The controller will perform no
functions until the board is placed in the correct orientation. If the board is in the correct orientation, it
will then check the UART RX buffer to see if any user has tried to connect to the board through UART. If
there is something in the RX buffer, the controller will stop the continuous loop and remain within UART
control. UART control will allow the user to read global variables (sensor data and digital output
conditions) and modify set points. These set points define when actions are performed (i.e. when valves
are opened, when pilot lights are enabled).
If the board is in the correct orientation and the UART is not being used, the code will continue in the
main loop, reading sensors and modifying outputs (relays, LEDs, etc). This loop does not need to be fast
(~30Hz), so delays can be added in the code.
All analog measurements should be averaged in software. 10 measurements should be made and then
averaged.

UART Terminal
Once the user connects, all they have to do is press any key and then the controller will switch into the
UART mode (CheckUART(RX)). This will stop the controller from doing the functionality it was doing
within the continuous loop.
Commands:
get <variable name> - this function will return the value of that variable (based off the table above)
set <variable name> <value> - this function will first check that the variable can be written too, then
check that the value provided falls into the correct range. If so, it will set the variables value
end this will disconnect the UART communications and release the controller. The controller will
return to the continuous loop

Software Pseudo Code


Enable analog inputs for RA0, RA1 and RA5. Enable digital I/Os for all other pins.
I/O Port initialization (TRIS bits). Disable all outputs.
Initialize UART comms. Enable UART comms and wait for a command to fill the buffer
Initialize SPI communications. Enable and configure MAX31865ATP. Disable
Initialize I2C communications. Enable and read device IDs for slave address 0x4c only
While(1)
CheckAccl()
CheckUART(RX)
Read VBAT_VMON (Analog) and Read VBAT_CUR (Analog)
If (VBAT_VMON < VBAT_WARN)
RED_LED1 = 1 (Battery error)
Else
GRN_LED3 = 1 (Battery good)
Read THERM_IN(SPI)
Read RTD_IN(SPI)
Read NTC_TEMP(Analog)
If (THERM_IN >= THERM_IN_MIN) and (RTD_IN <= RTD_IN_MIN) and (NTC_TEMP <=
NTC_TEMP_MIN)
Enable LM_VALVE = 1
int dt = RTD_IN NTC_TEMP
If (RTD_IN <= (RTD_IN_MIN 20C)) and (NTC_TEMP <= NTC_TEMP_MIN) and (dt <=
DELTA_T)
Enable HM_VALVE = 1
Else If (THERM_IN <= THERM_IN_MIN) or (RTD_IN >= RTD_IN_MAX) or (NTC_TEMP >=
NTC_TEMP_MAX)
Disable LM_VALVE = 0
If (RTD_IN <= (RTD_IN_MIN)) and (NTC_TEMP >= NTC_TEMP_MIN)
Disable HM_VALVE = 0

Functions
CheckAccl()
ReadI2C the three axis registers (x, y, z)
Fill the variables ACCL_X, ACCL_Y, ACCL_Z these are UART visible variables
Check that z is facing up axis values (based off Appendix C in datasheet)
Z should be between 0g and ANG_LIM (0.281g )
If not, flash all 6 LEDs (RED1-3 and GRN1-3)
Turn off LM_VALVE and HM_VALVE; keep PILOT_RELIGHT high if already high
Do not stop flashing LEDs until ACCL_Z is < ANG_RST (while loop until valid)
If ACCL_Z is valid, return 0 from the loop
CheckUART(RX)
Read UART RX buffer and if there was a key press, go into UART debug mode
This mode will hold the device in this function (CheckUART(RX)) until the user disconnects from
the UART terminal

Ignition Sequence

Master switch and temperature sensors are within operating range and gyroscope circuit is
closed than open main valve and igniter is activated. Maximum 5 min (user defined) if after 5
mins no millivolt signal than shut down the main gas valve, and burner is in active for 30 mins.
(user defined) After 30 mins the ignition sequence re-ignites.
Ignition is activated for 1 min user defined if no millivolt signal than shut down the main gas
valve for 1 min. user defined.

Modes of operation

Match battery loss consumption to a maximum of 40 watts


Power output 40 watts
Adjustable power outputs (user defined)
Adjustable voltage output (user defined)
AC/DC change
No battery draw unit shuts down until battery is @ 80 percent (user defined)
No battery draw unit shuts down until battery is @ 80 percent (user defined) max output
adjustable (user defined)

Das könnte Ihnen auch gefallen