SlideShare a Scribd company logo
1
Faculty of Science, Engineering and Computing
School of Mechanical and Aerospace Engineering
Module: ME7731
Control Systems with Embedded Implementation
Coursework 1: Freescale
Microcontroller programming -
Microprocessor control of an
Industrial Oven
NAME: ATHANASIOS GALATAS
ID: K1639752
COURSE: MECHATRONIC SYSTEMS
NAME: SHIH CHENG TUNG
ID: K1617281
COURSE: AUTOMOTIVE ENGINEERING
2
Contents
Cover page: Freescale Microcontroller programming.......................................1
Table of figures………………………………………………………………………3
Abstract……………………………………………………………………………… 4
1. Introduction……………………………………………………………………….5
2. Brief description………………………………………………………………….5
3. Analysis…………………………………………………………………………...6
4. Debugging strategy……………………………………………………………
5. Flowchart…………………………………………………………………………
References………………………………………………………………………….
Appendix: Freescale Codewarrior Code ……………………………………
3
Table of figures
Figure 1. Freescale semiconductor (2016)…………………………………………….5
Figure 2. Freescale semiconductor connections “Control of an Industrial Oven”
(2016)……………………………………………………………………………………....9
4
Abstract
This report describes the control of an industrial oven using the Freescale
semiconductor module. Starting with the functional specifications; then
progressing to the description of the signals used, specifications and functions
were needed for this task. Following the analysis of the code, analog to digital
converter registers, functions were used as well as how the program works.
Connections for the ports of inputs, outputs and LED indications are described.
Lastly, a flowchart of the program is presented and debugging issues are
provided.
Key words: Freescale, signals, function, program, flowchart
5
1. Introduction
This task is about the control of an industrial oven. Our client is a sterilizing
medical equipment manufacturer, who wants to utilize this oven in temperatures
up to 250°C. For this project we will use the MC9S12C128 module with the
Freescale Axiom PBMCUSLK microcontroller (Figure 1). Our program will be
written in C language and after debugging the system will be simulated by using
the switch, pushbutton and two POTs of the board. This will help us to control the
current and required temperatures in order to test the program functions before it
will be used in the field.
Figure 1 Freescale Axiom PBMCUSLK microcontroller (2016)
6
2. Brief Description
We are going to use several inputs and outputs of the board to execute functions
properly. In particular, the signals which are going to be used are:
Function Signal
1. Start oven
2. Door closed
3. Door locked for temperatures over 100°C
4. Oven temperature set (POT)
5. Simulated temperature set (POT)
6. Oven ON/OFF indication (LED)
7. Door closed ON/OFF indication (LED)
8. Door locked ON/OFF indication (LED)
9. Heater ON/OFF indication (LED)
10.Temperature monitoring (LED)
11.Temperature out of range indication (LED)
This industrial oven will enter into operation by an ON/OFF switch and a LED
indication will show the operating mode. On of the potentiometer will adjust the
temperature up to 250°C and it will be monitored by 8 LEDs. Also, a potentiometer
will be used for the simulation of the temperature to test the oven. After closing the
door, the “door closed” indication LED will be switched on and when the
temperature reach 100°C the “door locked” indication will be switched on. If the
oven’s temperature overcomes the normal operation temperature (250°C) a
blinking LED alert will take place.
For the programming of the microcontroller we will use the “Codewarrior IDE” v5.2
software, C code language and USB port connect to the computer. All appropriate
wires will be connected to the module for the input and output signals. For the
temperature monitoring the onboard LED1 to LED8 will be used and displayed in
binary mode; the current and setting temperature will be adjusted from the two
onboard POTs (one on microcontroller and the other on the module) converting
the analog signal to digital with ATD converter. Also, three additional LEDs will be
used for the digital output signals.
In programming, before starting the analog to digital converter (ATD) for the POTs
function it is needed to declare its registers and specifications. After that, the
board’s outputs and inputs that will be used have to be declared. Then, functions
for the specific oven’s operation and temperature simulation will be written.
Furthermore, for the proper function of the code it is needed to compile and debug
for any errors, before final tests take place.
DI
DI
DI
AI
AI
DO
DO
DO
DO
DO
DO
7
-
START
SW1
LED 1 ON
(Power
indication)
LED 1 OFF
(Power
indication)
POT 2
POT 1
PB1
LED 2 ON
(Door closed
indication)
LED 3 ON
(Door locked
indication)
POT 1 POT 2
LED 4 BLINK
(Warning
indication)
LED 4 OFF
(Warning
indication)
TEMP
MONITORING
OFF
TEMP
MONITORING
ON
LED 2 OFF
(Door closed
indication)
LED 3 OFF
(Door locked
indication)
>250
>250
>100
>100
OFF
ON
PUSH
RELEASE
8
Analysis
In the beginning of the code it is needed to declare the registers of the ATD. The
first register we declare is the ATDCTL2 to turn on the analog to digital converter;
the ADPU bit is used (Muhammad Ali Mazidi, Danny Causey, 2009, p. 444). So,
we have ADPU=1, AFFC=0 for normal flag clearing, AWAI=0 for the ATD to run in
wait mode. For the external trigger level and polarity we use falling edge sensitivity
(ETRIGLE:ETRIGP=00). The external trigger mode and the ATD sequence
complete interrupt are disabled (ETRIGE=0), (ASCIE=0). Lastly, there is no ATD
interrupt occurred (ASCIF=0). The register ATDCTL2 = 0b10000000 is declared.
The next register of the HCS12’s ATD declared is the ATDCTL3 which is used to
choose the amount of conversions per sequence. We choose “number of
conversions per sequence” (0010), because we want the ATD to convert the input
and place the results in ATDDR registers for the conversion of the POTs. Disabled
FIFO mode (0), FRZ1 and FRZ0 (00) continue conversion in freeze mode (break
point) is chosen (Muhammad Ali Mazidi, Danny Causey, 2009, p. 445). The
declaration for ATDCTL3 = 0b00010000.
The ATDCTL4 register will be used to select the conversion speed and the
resolution. Using the SRES8 bit 1 we select 8-bit resolution (Muhammad Ali
Mazidi, Danny Causey, 2009, p. 441). Then, using the SMP1:SMP0 we select the
sample time (00) for 2 A/D conversion clocks. For the A/D prescaler clock and bits
PRES4:PRES0 (0000) is selected as divisor value by 2. So, for the register
ATDCTL4 is declared ATDCTL4=0b10000000.
This program requires 12 outputs for the LEDs and 1 input. As we move on the
main function, HCS12’s inputs and outputs have to be declared. We setup PORTB
as output (DDRB =0xFF), PORTT bit-2-3-4 as outputs (DDRT = DDRT |
0b00011100) and PORTP bit-0 as output whilst PORTA bit-0 is declared as input
(DDRA &= 0x00). PORTB will be used for the temperature monitoring LEDs. Then
we initialize (turn off) the monitoring LEDs (PORTB), the start oven, close door
and alarm LEDs (PORTT) and the door locked over 100°C LED (PORTP). The
ATD converter initialization and the use of endless loop “for” are followed.
The register ATDCTL5 = 0b10110101 is declared to select the input analog
channel and start the conversion.
 DJM=1, Result register data right-justified
 DSGN=0, unsigned data representation
 SCAN=1, continuous conversion sequence
 MULT=1, sample across several channels
 CC CB CA=101, channel 5 (AN5) to start conversion
9
The conversion of the first potentiometer (on the microcontroller) will be stored in
variable ATDDR0L while the conversion of the second potentiometer (on the
Freescale board) will be stored in variable ATDDR1L.
Before start the conversion we have a function “if” for the main switch. Only if main
switch (PORTA_BIT0) is ON our program continuous to the next steps else it goes
to the end and do nothing turning off all LEDs.
When the oven starts (PORTA_BIT0 is ON) the temperature can be adjusted with
POTs and set the desired and the simulated temperature. The function for alarm
and warning temperatures greater or equal to 250°C follows. If registers ATDDR0L
and ATDDR1L are equal or greater than 250°C turn off all LEDs (PORTB, PORTP,
PORT_BIT3, PORTT_BIT4) and turn on and off the LED PORTT_BIT2 with
5000ms delay (blinking alarm).
For the temperature monitoring we use the onboard 8 LEDs which are connected
as outputs in PORTB. There can be monitoring the setting and the current
temperature and will show the smaller one. So, if POT1>POT2, 8 LEDs show the
result of POT2, else If POT2>POT1, 8 LEDs show the result of POT1. Door closed
and main switch indications LEDs remain ON.
Then the door locked function follows in which we want the door closed indication
to be ON after the 100°C. If the results in registers ATDDR0L and ATDDR1L are
greater than 100°C door locked indication in PORTP is ON, else if POT1 or POT2
are turned below 100°C door closed indication is off. Door closed and main switch
indications LEDs remain ON.
Freescale Semiconductor module connections
 PORTB (PB0-PB7) connected with onboard LEDs 1-8
 Switch ON/OFF SW1 as input in PA0
 Door locked external LED as output to PP0
 Switch ON/OFF LED as output to PT4 using a resistor for the LED
 Door closed indication LED as output to PT3
 Alarm indication LED to output PT2 using a resistor
 POT2 as input to PAD06
 One cable is connected to ground pin (GRD) to feed the breadboard
 A cable is connected from door closed LED to locked door LED for the
pushbutton PB1 to work for both
10
No resistors were used for the closed and door locked LEDs because the power of
the board was not enough to feed them and the pushbutton where are connected
has a resistor inside.
Connections and LED indicators are shown in the figure below.
Figure 2. Freescale semiconductor connections “Control of an Industrial Oven” (2016)
Debugging Strategy
Due to different outputs will be used in the programme, we have to explore other
ports of MC9S12C128. The format of other ports are slightly different, for example,
‘’PT’’ is been used instead of ‘’PORT’’. Thus ‘’PORTT_BIT0’’ caused an error in
the programme then that need to be replaced into ‘’PTT_PTT0’’.
‘’IF’’ instruction is essential part of the programme in order to approach the several
functions. The priority of conditions is one of the important requirements. The
function could be skipped with wrong order of instruction. For example, the LED
could be turn off when it supposed to be turn on. It is necessary to understand the
condition of every loops which are used.
11
12
250°
250°
100°
100°
START
POWER
LED 1 ON
PB1
LED 3 OFF
LED 3 ON
LED 2 ON
LED 2 OFF
LED 1 OFF
POT 1
POT 2
POT 2
LED 4 BLINKLED 4 OFF

More Related Content

PPTX
Microprocessor based Temperature Controller
PDF
Plc operation part 3
PPTX
Micro Processor Mini Project,Electronic Quiz Table
DOCX
Digital Clock Using Logic Gates
PPT
PIC timer programming
PPTX
8051 training an interactive tutorial
PDF
Regolatore Controller-Ucontrol
PDF
Micro Processor Lab Manual!
Microprocessor based Temperature Controller
Plc operation part 3
Micro Processor Mini Project,Electronic Quiz Table
Digital Clock Using Logic Gates
PIC timer programming
8051 training an interactive tutorial
Regolatore Controller-Ucontrol
Micro Processor Lab Manual!

What's hot (20)

DOCX
Digital clock
PDF
Digital stop watch
PPTX
Digital Clock
PDF
Using Ready-for-PIC and SDR Libraries
PPTX
Timer counter in arm7(lpc2148)
PPTX
Digital clock workshop
DOCX
Project report on the Digital clock using RTC and microcontroller 8051
PPTX
Digital clock presentation
PDF
dspAt89 s52
PPT
I o ports and timers of 8051
PDF
Using Timers in PIC18F Microcontrollers
PDF
Using Timer2 in Microchip MCUs
PDF
Microprocessor 8051
PPTX
PLC LADDER DIAGRAM
PDF
Pt650 d英文说明书 (1)
PPTX
Final Presentation
PPT
E4800 ej501 topic_5_designing_plc_application
PPTX
8051 Timers and Counters
PPTX
Microcontroller ppt
Digital clock
Digital stop watch
Digital Clock
Using Ready-for-PIC and SDR Libraries
Timer counter in arm7(lpc2148)
Digital clock workshop
Project report on the Digital clock using RTC and microcontroller 8051
Digital clock presentation
dspAt89 s52
I o ports and timers of 8051
Using Timers in PIC18F Microcontrollers
Using Timer2 in Microchip MCUs
Microprocessor 8051
PLC LADDER DIAGRAM
Pt650 d英文说明书 (1)
Final Presentation
E4800 ej501 topic_5_designing_plc_application
8051 Timers and Counters
Microcontroller ppt
Ad

Similar to Freescale Microcontroller programming (20)

PDF
Design and Implementation of Automatic Fire Fighting for Building using Perip...
DOC
Anup2
PPTX
Six channel fire monitoring & control
PDF
Water Temperature
PDF
EEE UNIT-2 PPT.pdf
PDF
Microprocessor project
DOCX
digital clock atmega16
PDF
Mixed Signal PSoC based System
PPTX
MICROCONTROLLER BASED IR FOR HOME APPLICATION
PDF
HOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHM
PPTX
Sensor interfacing in 8051
DOCX
Auto dial-er Home security
PPTX
UNIT 4 & 5 - I nterfacing_Lecture7.pptx
PPTX
Temperature Based Fan Controller
DOCX
Temperature monitoring and controling using arduino
PPTX
8051 MICROCONTROLLER AND ITS APPLICATIONS
PPTX
Capston project ITT
PDF
M44096368
PDF
Advanced Embedded Automatic Car Parking System
Design and Implementation of Automatic Fire Fighting for Building using Perip...
Anup2
Six channel fire monitoring & control
Water Temperature
EEE UNIT-2 PPT.pdf
Microprocessor project
digital clock atmega16
Mixed Signal PSoC based System
MICROCONTROLLER BASED IR FOR HOME APPLICATION
HOME AUTOMATION SYSTEM DESIGN USING ROUND ROBIN SCHEDULING ALGORITHM
Sensor interfacing in 8051
Auto dial-er Home security
UNIT 4 & 5 - I nterfacing_Lecture7.pptx
Temperature Based Fan Controller
Temperature monitoring and controling using arduino
8051 MICROCONTROLLER AND ITS APPLICATIONS
Capston project ITT
M44096368
Advanced Embedded Automatic Car Parking System
Ad

More from Shih Cheng Tung (8)

DOCX
Automotive Hybrid Technology Development - Past, Present and Future
DOCX
Practical analysis of maintenance methods of a hybrid vehicle powertrains
DOCX
Solar Energy Technology and Incentives
DOCX
Biomass, Biofuel and Solar Energy Technology
PDF
Design and optimization of parts of a suspension system
DOCX
CFD analysis of commercial vehicle
DOCX
Researching Methodology
DOC
Development of controller for electric racing motorcycle
Automotive Hybrid Technology Development - Past, Present and Future
Practical analysis of maintenance methods of a hybrid vehicle powertrains
Solar Energy Technology and Incentives
Biomass, Biofuel and Solar Energy Technology
Design and optimization of parts of a suspension system
CFD analysis of commercial vehicle
Researching Methodology
Development of controller for electric racing motorcycle

Recently uploaded (20)

DOCX
573137875-Attendance-Management-System-original
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PPT
introduction to datamining and warehousing
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPT
Total quality management ppt for engineering students
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Construction Project Organization Group 2.pptx
573137875-Attendance-Management-System-original
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Safety Seminar civil to be ensured for safe working.
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
introduction to datamining and warehousing
UNIT 4 Total Quality Management .pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
Internet of Things (IOT) - A guide to understanding
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Total quality management ppt for engineering students
R24 SURVEYING LAB MANUAL for civil enggi
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Mechanical Engineering MATERIALS Selection
Construction Project Organization Group 2.pptx

Freescale Microcontroller programming

  • 1. 1 Faculty of Science, Engineering and Computing School of Mechanical and Aerospace Engineering Module: ME7731 Control Systems with Embedded Implementation Coursework 1: Freescale Microcontroller programming - Microprocessor control of an Industrial Oven NAME: ATHANASIOS GALATAS ID: K1639752 COURSE: MECHATRONIC SYSTEMS NAME: SHIH CHENG TUNG ID: K1617281 COURSE: AUTOMOTIVE ENGINEERING
  • 2. 2 Contents Cover page: Freescale Microcontroller programming.......................................1 Table of figures………………………………………………………………………3 Abstract……………………………………………………………………………… 4 1. Introduction……………………………………………………………………….5 2. Brief description………………………………………………………………….5 3. Analysis…………………………………………………………………………...6 4. Debugging strategy…………………………………………………………… 5. Flowchart………………………………………………………………………… References…………………………………………………………………………. Appendix: Freescale Codewarrior Code ……………………………………
  • 3. 3 Table of figures Figure 1. Freescale semiconductor (2016)…………………………………………….5 Figure 2. Freescale semiconductor connections “Control of an Industrial Oven” (2016)……………………………………………………………………………………....9
  • 4. 4 Abstract This report describes the control of an industrial oven using the Freescale semiconductor module. Starting with the functional specifications; then progressing to the description of the signals used, specifications and functions were needed for this task. Following the analysis of the code, analog to digital converter registers, functions were used as well as how the program works. Connections for the ports of inputs, outputs and LED indications are described. Lastly, a flowchart of the program is presented and debugging issues are provided. Key words: Freescale, signals, function, program, flowchart
  • 5. 5 1. Introduction This task is about the control of an industrial oven. Our client is a sterilizing medical equipment manufacturer, who wants to utilize this oven in temperatures up to 250°C. For this project we will use the MC9S12C128 module with the Freescale Axiom PBMCUSLK microcontroller (Figure 1). Our program will be written in C language and after debugging the system will be simulated by using the switch, pushbutton and two POTs of the board. This will help us to control the current and required temperatures in order to test the program functions before it will be used in the field. Figure 1 Freescale Axiom PBMCUSLK microcontroller (2016)
  • 6. 6 2. Brief Description We are going to use several inputs and outputs of the board to execute functions properly. In particular, the signals which are going to be used are: Function Signal 1. Start oven 2. Door closed 3. Door locked for temperatures over 100°C 4. Oven temperature set (POT) 5. Simulated temperature set (POT) 6. Oven ON/OFF indication (LED) 7. Door closed ON/OFF indication (LED) 8. Door locked ON/OFF indication (LED) 9. Heater ON/OFF indication (LED) 10.Temperature monitoring (LED) 11.Temperature out of range indication (LED) This industrial oven will enter into operation by an ON/OFF switch and a LED indication will show the operating mode. On of the potentiometer will adjust the temperature up to 250°C and it will be monitored by 8 LEDs. Also, a potentiometer will be used for the simulation of the temperature to test the oven. After closing the door, the “door closed” indication LED will be switched on and when the temperature reach 100°C the “door locked” indication will be switched on. If the oven’s temperature overcomes the normal operation temperature (250°C) a blinking LED alert will take place. For the programming of the microcontroller we will use the “Codewarrior IDE” v5.2 software, C code language and USB port connect to the computer. All appropriate wires will be connected to the module for the input and output signals. For the temperature monitoring the onboard LED1 to LED8 will be used and displayed in binary mode; the current and setting temperature will be adjusted from the two onboard POTs (one on microcontroller and the other on the module) converting the analog signal to digital with ATD converter. Also, three additional LEDs will be used for the digital output signals. In programming, before starting the analog to digital converter (ATD) for the POTs function it is needed to declare its registers and specifications. After that, the board’s outputs and inputs that will be used have to be declared. Then, functions for the specific oven’s operation and temperature simulation will be written. Furthermore, for the proper function of the code it is needed to compile and debug for any errors, before final tests take place. DI DI DI AI AI DO DO DO DO DO DO
  • 7. 7 - START SW1 LED 1 ON (Power indication) LED 1 OFF (Power indication) POT 2 POT 1 PB1 LED 2 ON (Door closed indication) LED 3 ON (Door locked indication) POT 1 POT 2 LED 4 BLINK (Warning indication) LED 4 OFF (Warning indication) TEMP MONITORING OFF TEMP MONITORING ON LED 2 OFF (Door closed indication) LED 3 OFF (Door locked indication) >250 >250 >100 >100 OFF ON PUSH RELEASE
  • 8. 8 Analysis In the beginning of the code it is needed to declare the registers of the ATD. The first register we declare is the ATDCTL2 to turn on the analog to digital converter; the ADPU bit is used (Muhammad Ali Mazidi, Danny Causey, 2009, p. 444). So, we have ADPU=1, AFFC=0 for normal flag clearing, AWAI=0 for the ATD to run in wait mode. For the external trigger level and polarity we use falling edge sensitivity (ETRIGLE:ETRIGP=00). The external trigger mode and the ATD sequence complete interrupt are disabled (ETRIGE=0), (ASCIE=0). Lastly, there is no ATD interrupt occurred (ASCIF=0). The register ATDCTL2 = 0b10000000 is declared. The next register of the HCS12’s ATD declared is the ATDCTL3 which is used to choose the amount of conversions per sequence. We choose “number of conversions per sequence” (0010), because we want the ATD to convert the input and place the results in ATDDR registers for the conversion of the POTs. Disabled FIFO mode (0), FRZ1 and FRZ0 (00) continue conversion in freeze mode (break point) is chosen (Muhammad Ali Mazidi, Danny Causey, 2009, p. 445). The declaration for ATDCTL3 = 0b00010000. The ATDCTL4 register will be used to select the conversion speed and the resolution. Using the SRES8 bit 1 we select 8-bit resolution (Muhammad Ali Mazidi, Danny Causey, 2009, p. 441). Then, using the SMP1:SMP0 we select the sample time (00) for 2 A/D conversion clocks. For the A/D prescaler clock and bits PRES4:PRES0 (0000) is selected as divisor value by 2. So, for the register ATDCTL4 is declared ATDCTL4=0b10000000. This program requires 12 outputs for the LEDs and 1 input. As we move on the main function, HCS12’s inputs and outputs have to be declared. We setup PORTB as output (DDRB =0xFF), PORTT bit-2-3-4 as outputs (DDRT = DDRT | 0b00011100) and PORTP bit-0 as output whilst PORTA bit-0 is declared as input (DDRA &= 0x00). PORTB will be used for the temperature monitoring LEDs. Then we initialize (turn off) the monitoring LEDs (PORTB), the start oven, close door and alarm LEDs (PORTT) and the door locked over 100°C LED (PORTP). The ATD converter initialization and the use of endless loop “for” are followed. The register ATDCTL5 = 0b10110101 is declared to select the input analog channel and start the conversion.  DJM=1, Result register data right-justified  DSGN=0, unsigned data representation  SCAN=1, continuous conversion sequence  MULT=1, sample across several channels  CC CB CA=101, channel 5 (AN5) to start conversion
  • 9. 9 The conversion of the first potentiometer (on the microcontroller) will be stored in variable ATDDR0L while the conversion of the second potentiometer (on the Freescale board) will be stored in variable ATDDR1L. Before start the conversion we have a function “if” for the main switch. Only if main switch (PORTA_BIT0) is ON our program continuous to the next steps else it goes to the end and do nothing turning off all LEDs. When the oven starts (PORTA_BIT0 is ON) the temperature can be adjusted with POTs and set the desired and the simulated temperature. The function for alarm and warning temperatures greater or equal to 250°C follows. If registers ATDDR0L and ATDDR1L are equal or greater than 250°C turn off all LEDs (PORTB, PORTP, PORT_BIT3, PORTT_BIT4) and turn on and off the LED PORTT_BIT2 with 5000ms delay (blinking alarm). For the temperature monitoring we use the onboard 8 LEDs which are connected as outputs in PORTB. There can be monitoring the setting and the current temperature and will show the smaller one. So, if POT1>POT2, 8 LEDs show the result of POT2, else If POT2>POT1, 8 LEDs show the result of POT1. Door closed and main switch indications LEDs remain ON. Then the door locked function follows in which we want the door closed indication to be ON after the 100°C. If the results in registers ATDDR0L and ATDDR1L are greater than 100°C door locked indication in PORTP is ON, else if POT1 or POT2 are turned below 100°C door closed indication is off. Door closed and main switch indications LEDs remain ON. Freescale Semiconductor module connections  PORTB (PB0-PB7) connected with onboard LEDs 1-8  Switch ON/OFF SW1 as input in PA0  Door locked external LED as output to PP0  Switch ON/OFF LED as output to PT4 using a resistor for the LED  Door closed indication LED as output to PT3  Alarm indication LED to output PT2 using a resistor  POT2 as input to PAD06  One cable is connected to ground pin (GRD) to feed the breadboard  A cable is connected from door closed LED to locked door LED for the pushbutton PB1 to work for both
  • 10. 10 No resistors were used for the closed and door locked LEDs because the power of the board was not enough to feed them and the pushbutton where are connected has a resistor inside. Connections and LED indicators are shown in the figure below. Figure 2. Freescale semiconductor connections “Control of an Industrial Oven” (2016) Debugging Strategy Due to different outputs will be used in the programme, we have to explore other ports of MC9S12C128. The format of other ports are slightly different, for example, ‘’PT’’ is been used instead of ‘’PORT’’. Thus ‘’PORTT_BIT0’’ caused an error in the programme then that need to be replaced into ‘’PTT_PTT0’’. ‘’IF’’ instruction is essential part of the programme in order to approach the several functions. The priority of conditions is one of the important requirements. The function could be skipped with wrong order of instruction. For example, the LED could be turn off when it supposed to be turn on. It is necessary to understand the condition of every loops which are used.
  • 11. 11
  • 12. 12 250° 250° 100° 100° START POWER LED 1 ON PB1 LED 3 OFF LED 3 ON LED 2 ON LED 2 OFF LED 1 OFF POT 1 POT 2 POT 2 LED 4 BLINKLED 4 OFF