SlideShare a Scribd company logo
Chapter 4
Assembly
Programming III
Firmware is a program that provides the low-level control for the device's specific hardware,
performing all control, monitoring and data manipulation functions. Typical examples of devices
containing firmware are embedded systems, consumer appliances, computers, computer
peripherals, and others. Firmware is held in non-volatile memory devices such as EPROM, or flash
memory. Common reasons for updating firmware include fixing bugs or adding features to the
device, then the flash memory is reprogrammed. Firmware such as the program of an embedded
system may be the only program that will run on the system and provide all of its functions.
Assembly Programming………………….…………….…….………. 1
I2C Communication……….…………….…………….…….………. 1
Switch/Led……….…………………….…………….…….………. 4
32-bit Math……….…………………….…………….…….……….6
SPI Protocol……….…………………….…………….…….……….7
IR Remote Control: SIRC Protocol ……….…………………….………. 8
Power Supply Monitor ……….…………………..………….………. 9
Watchdog Timer ……….…………………..………….……..……. 10
Rotary Encoder ……….…………………..…….…….……..……. 10
I2C communication is initiated by the master sending a START condition and terminated by the master sending a
STOP condition. A high-to-low transition on the SDA line while the SCL is high defines a START condition. A low-to-
high transition on the SDA line while the SCL is high defines a STOP condition. One data bit is transferred during
each clock pulse of the SCL. One byte is comprised of eight bits on the SDA line. Data is transferred Most Significant
Bit (MSB) first. Data on the SDA line must remain stable during the high phase of the clock period, as shows below
Each byte of data (including the address byte) is followed by one ACK bit from the receiver. The ACK bit (SDA “0” in 9
CLK high pulse) allows the receiver to communicate to the transmitter that the byte was successfully received
I2C Communication
Assembly Programming
1
Stop
Bit
Bit
Start
SCL
SDA
1 2 3 4 5 6 7 8 9
ACK
The following program uses the I2C communication to send a character to a display (NEWHAVEN, NHD‐0420D3Z‐
NSW‐BBW‐V3)
Assembly Programming
2
To read from a slave, the master must first instruct the slave which register it wishes to read from. This is done by
the master starting off the transmission in a similar fashion as the write, by sending the address with the R/W bit
equal to 0, followed by the register address it wishes to read from. Once the slave acknowledges this register
address, the master will send a START condition again, followed by the slave address with the R/W bit set to 1. This
time, the slave will acknowledge the read request, and the master releases the SDA bus, so that the slave can
transmit data. The master will continue supplying the clock to the slave. At the end of every byte of data, the master
will send an ACK to the slave, Once the master has received the number of bytes it is expecting, it will send a NACK,
signaling to the slave to halt communications and release the bus. The master will follow this up with a STOP
condition. The following program shows how to read a byte
The following waveforms shows the process of programming the 16-Bit I/O Expander with I2C Interface: MCP-23017.
ACK ACKACK ACKStart
Stop
Slave Address: 42H IODIRA: 00H Port A: Output Port B: Input
R/W=0
Assembly Programming
3
Writing to I2C: Sending 55H to Port A
Reading from I2C: Getting value from Port B
To attend a switch or button it is necessary to consider:
✓ Bounce time (10 msec)
✓ Press time (50 - 100 msec or greater)
The pins of Ports 2 and 3 than have internal pull-ups must have 1s written to them, and in that state can be used as
inputs.
Two of the most common configurations of switch interface are shows below
Switch/Led
Assembly Programming
Start
Stop
Slave Address: 42H Port A Address: 12H Value to Write: 55HACK ACK ACK
R/W=0
R/W=0
ACK ACK ACK
Slave Address: 42H
Start
Port B Address: 13H Start Slave Address: 43H
R/W=1
Stop
Read Value: 55H
NACK
4
Response time of button, key or switch: SW1 (“1” active), SW2 (“0” active)
Getting value from Port B
Assembly Programming
5
16-bit and 32-bit math routines can be used to extend the calculation capacity of the microcontroller, the most
popular is the Application Brief AB-40 from INTEL. The 32-bit Math Routines can be useful to calculate equations in
floating-point using equivalent calculation in fixed-point. The fundamental routines are: MUL_16, DIV_16, ADD_16,
SUB_16, ADD_32, SUB_32.
Fixed Point Arithmetic
The Internal Temperature Sensor of ADuC842 has a voltage output of 700mV at 250C, with a variation of -1.4mV/0C.
The Equivalent Voltage of a Hexadecimal Code in an ADC (12 bits, Vref = 2.5V) is:
Voltage = 2.5*HEXADECIMAL_CODE/2^12
Using the above relations, after some Math, we can obtain the temperature equivalent to a Hexadecimal Code:
Temperature = 525 – 0.436*HEXADECIMAL_CODE
In order to avoid the floating-point arithmetic, we can obtain an equivalent relation using integer values:
Temperature = (5250000 – 4360*HEXADECIMAL_CODE)/1000
>> 525 - 0.436*Cod_Hex
ans = 25.3440
>> (5250000-4360*Cod_Hex)/1000
ans = 253.4400
Temperature from ADC
Principal Program
Temperature Calculation (32-bit Math)
32-bit Math
Assembly Programming
6
Serial Peripheral Interface (SPI) uses a four-wire serial bus:
SS (Slave Select, Active Low): Specific to each slave. This is the pin that the SPI master use to enable the device.
SCK (Serial Clock): The master generates the clock pulses that synchronize the data transmission.
MOSI (Master Out Slave In) – This line is the master line for sending data to the SPI peripherals.
MISO (Master In Slave Out) – This line is the slave line for sending data to the SPI master.
Data Transmission (CPOL=0, CPHA=0):
1.- The master selects the slave by setting the SS pin of slave to low (SCK must be low).
2.- The master sends a bit on MOSI line and the slave reads it on the clock's low-to-high transition. The slave also
sends a bit on the MISO line on the falling edge of the SCK, so that the data would be stable when read by the
master on rising edges of SCK.
3.- When the transfer is complete, the master stops toggling the SCK and mostly pulls up the SS to deselect the slave.
SPI Protocol
Transferring 0A5H (MSB first)
Assembly Programming
SCK
SS
MOSI
MISO
MSB LSB
7
Then, a new high to low transition is waited to detect the first bit. The value of a bit is sample each 900usec.
In the 12 bits SIRC version, each word is sent LSB first as shown bellow
The frames are repeated at an interval of 45msec, a minimum of 3 times. To assemble the input data, it’s necessary
to wait the START pulse (high to low transition) and wait 2500usec
IR Remote Control: SIRC Protocol
S 0 1 2 3 4 5 6 0 1 2 3 4
8
1 Level
Assembly Programming
Start(5T)
0(2T)1(3T)
Command (bits 0 - 6)
Address (bits 0 - 4)
T=0.6msec
0 Level
IR Remote tester in Password Protected System
Fundamental functions used to test the IR Remote Controller
(RCA RCRN03BR, programmed code: 10810)
KEYS_IDENT (KEYS_ID.asm): Output of IR Remote Controller
WRITE_FLASH (Write_Flash.asm): Write 4 digits to Internal Flash Memory
READ_FLASH_PASS (Read_Passw.asm): Read 4 digits from Internal Flash Memory
PASSW_CHECK (Pass_check.asm): Read 4 digits from IR Remote
VERY_PASSW (Windows_1.asm): Verify the Password (Internal Flash vs IR Remote)
PASSW_NEW (Pass_check.asm): Read 4 digits from IR Remote
PASSW_VERY (Pass_check.asm): Verify the Password (Enter and New Password)
PASSW_DEF_RUT (PASS_INIT.asm): Initial Password and Flag
Press this link for more information
The power supply monitor monitors the power supply on the Microconverter. It indicates when any of the supply
pins drops below one of two user selectable voltage trip points, 2.93 V and 3.08 V. Monitor function is controlled via
the PSMCON SFR. If enabled via the IEIP2 SFR, the monitor interrupts the core using the PSMI bit in the PSMCON
SFR. This bit is not cleared until the failing power supply has returned above the trip point for at least 250 msec. This
monitor function allows the user to save working registers to avoid possible data loss due to the low supply
condition and ensures that normal code execution does not resume until a safe supply level has been well
established.
Power Supply Monitor
Assembly Programming
9
The watchdog timer is a device that asserts a system reset or interrupt if it has not received a periodic pulse signal
from a processor within a specific time frame. The processor periodically sends a pulse to the watchdog timer to
indicate that the system software is operating properly. If the watchdog timer does not receive this pulse within an
allotted time frame (known as the watchdog timeout), the watchdog timer asserts a reset. The watchdog timer is
used to recover a microcontroller that has gone "out of control" due to power supply transients, electromagnetic
interference, electrostatic discharge, etc.
Incremental Rotary Encoders transduce rotational movement into electrical signals. If clockwise versus counterclockwise
movement must be distinguished, two encoder outputs with a phase offset can accomplish this. Then the order of 2-bit
states describes the direction turned, using a 90° phase offset (quadrature). Based on the feature size of an encoder, it
can produce a different number of output states per revolution. When the quadrature encoder is rotating in a clockwise
direction its signal will show Channel A leading Channel B, and the reverse will happen when the quadrature encoder
rotates counterclockwise. The rotary Encoder may have a built-in switch
Watchdog Timer
Rotary Encoder
Assembly Programming
10
De-Bounced
BA=00
BA=01
BA=11
BA=10
The sequence the encoder outputs while spinning clockwise is 00, 01, 11, 10 repeat. So if you have a reading of 01,
the next reading can either be 00 or 11 depending on the direction the knob is turned. So by adding the previous
encoded value to the beginning of the current encoded value we get: [BEFORE(BA)+CURRENT(BA)]
CW: 0001(1H), 0111(7H), 1110(0EH), 1000(8H)
CCW: 1011(0BH), 1101(0DH), 0100(4H), 0010(2H)
Assembly Programming
11

More Related Content

PDF
Assembly programming II
PDF
Assembly programming
PDF
Assembler Programming
PDF
89c5131datasheet
PDF
Microcontroller Instruction Set atmel
PDF
Embedded systems ppt i
PPTX
Interfacing with Atmega 16
PDF
Introduction to Microcontrollers
Assembly programming II
Assembly programming
Assembler Programming
89c5131datasheet
Microcontroller Instruction Set atmel
Embedded systems ppt i
Interfacing with Atmega 16
Introduction to Microcontrollers

What's hot (19)

PDF
Microcontroller part 2
PPT
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
PDF
8051 microcontrollers ch3
DOC
Pc based wire less data aquisition system using rf(1)
PPTX
8051 microprocessor
PPTX
Microcontroller 8051
PDF
8051 microcontroller
PPTX
Dma and dma controller 8237
PPT
Microcontroller 8051
PPTX
Presentation On: "Micro-controller 8051 & Embedded System"
PPT
PIC Introduction and explained in detailed
PPT
8051 microcontroller
PPSX
8051 architecture
PPT
Overview of LPC213x MCUs
PDF
8051 tutorial
PPT
8251
PPTX
MICROCONTROLLER 8051- Architecture & Pin Configuration
PPTX
Embedded System Programming on ARM Cortex M3 and M4 Course
PPTX
8051 Microcontroller
Microcontroller part 2
8051 microcontroller lecture ppt by Tarun Khaneja ( 9034406598 )
8051 microcontrollers ch3
Pc based wire less data aquisition system using rf(1)
8051 microprocessor
Microcontroller 8051
8051 microcontroller
Dma and dma controller 8237
Microcontroller 8051
Presentation On: "Micro-controller 8051 & Embedded System"
PIC Introduction and explained in detailed
8051 microcontroller
8051 architecture
Overview of LPC213x MCUs
8051 tutorial
8251
MICROCONTROLLER 8051- Architecture & Pin Configuration
Embedded System Programming on ARM Cortex M3 and M4 Course
8051 Microcontroller
Ad

Similar to Assembler4 (20)

PPTX
I2 c and mpu6050 basics
PPT
AVR Fundamentals
PPTX
Peripherals and interfacing
PPTX
Embedded systems and robotics by scmandota
PPTX
UNIT 5 Interfacing and Mixed Signal Controller.pptx
PPTX
UNIT 5.pptx
DOC
Gesture based vehicle movements control and alerting system docu
DOCX
project 3 full report
PPTX
MICROCONTROLLER.pptx
PDF
PPTX
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
PPT
PPTX
MicroProcessors and MicroControllersUnit3
PPT
I2C protocol and DS1307 RTC interfacing
PPTX
Slow peripheral interfaces (i2 c spi uart)
PPT
I2C Protocol
PPT
I2C PRESENTATION.PPT
PDF
Microcontroller part 4
PDF
Design &Implementation of I2C Master Controller Interfaced With RAM Using VHDL
PDF
Embedded_Systems_firstcourse_UniversitéToulouse.pdf
I2 c and mpu6050 basics
AVR Fundamentals
Peripherals and interfacing
Embedded systems and robotics by scmandota
UNIT 5 Interfacing and Mixed Signal Controller.pptx
UNIT 5.pptx
Gesture based vehicle movements control and alerting system docu
project 3 full report
MICROCONTROLLER.pptx
Universal synchronous asynchronous receiver transmitter(usart) and AtoD Coverter
MicroProcessors and MicroControllersUnit3
I2C protocol and DS1307 RTC interfacing
Slow peripheral interfaces (i2 c spi uart)
I2C Protocol
I2C PRESENTATION.PPT
Microcontroller part 4
Design &Implementation of I2C Master Controller Interfaced With RAM Using VHDL
Embedded_Systems_firstcourse_UniversitéToulouse.pdf
Ad

More from Omar Sanchez (20)

PDF
Assembly programming II
PDF
Functions for Nano 5 Card
PDF
Ejemplos de modelos basados en adaptacion parametrica
PDF
Sistemas numericos
PDF
Ensamblador
PDF
Nano5 features
PDF
Referencias MATLAB
PPT
Control Modelo de Referencia y Linealizacion po Realimentacion
PPTX
Fundposori
PPT
Segmentación de imagenes
PPT
Imagen e histograma
PPTX
Funciones de Lyapunov basado en Krasovskii
PPT
Sensores de robots
PPT
Vehiculos no tripulados
PPTX
Algunos aspectos de estabilidad
PPT
Control basado en modelo
PPT
Grupos próximos
PPT
Redes Neuronales
PPT
Algunas consideraciones
PPT
Sistemas jerárquicos
Assembly programming II
Functions for Nano 5 Card
Ejemplos de modelos basados en adaptacion parametrica
Sistemas numericos
Ensamblador
Nano5 features
Referencias MATLAB
Control Modelo de Referencia y Linealizacion po Realimentacion
Fundposori
Segmentación de imagenes
Imagen e histograma
Funciones de Lyapunov basado en Krasovskii
Sensores de robots
Vehiculos no tripulados
Algunos aspectos de estabilidad
Control basado en modelo
Grupos próximos
Redes Neuronales
Algunas consideraciones
Sistemas jerárquicos

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation theory and applications.pdf
PDF
Electronic commerce courselecture one. Pdf
PPT
Teaching material agriculture food technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Machine learning based COVID-19 study performance prediction
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
Understanding_Digital_Forensics_Presentation.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Dropbox Q2 2025 Financial Results & Investor Presentation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Empathic Computing: Creating Shared Understanding
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation theory and applications.pdf
Electronic commerce courselecture one. Pdf
Teaching material agriculture food technology
Chapter 3 Spatial Domain Image Processing.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine learning based COVID-19 study performance prediction
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Spectral efficient network and resource selection model in 5G networks

Assembler4

  • 1. Chapter 4 Assembly Programming III Firmware is a program that provides the low-level control for the device's specific hardware, performing all control, monitoring and data manipulation functions. Typical examples of devices containing firmware are embedded systems, consumer appliances, computers, computer peripherals, and others. Firmware is held in non-volatile memory devices such as EPROM, or flash memory. Common reasons for updating firmware include fixing bugs or adding features to the device, then the flash memory is reprogrammed. Firmware such as the program of an embedded system may be the only program that will run on the system and provide all of its functions.
  • 2. Assembly Programming………………….…………….…….………. 1 I2C Communication……….…………….…………….…….………. 1 Switch/Led……….…………………….…………….…….………. 4 32-bit Math……….…………………….…………….…….……….6 SPI Protocol……….…………………….…………….…….……….7 IR Remote Control: SIRC Protocol ……….…………………….………. 8 Power Supply Monitor ……….…………………..………….………. 9 Watchdog Timer ……….…………………..………….……..……. 10 Rotary Encoder ……….…………………..…….…….……..……. 10
  • 3. I2C communication is initiated by the master sending a START condition and terminated by the master sending a STOP condition. A high-to-low transition on the SDA line while the SCL is high defines a START condition. A low-to- high transition on the SDA line while the SCL is high defines a STOP condition. One data bit is transferred during each clock pulse of the SCL. One byte is comprised of eight bits on the SDA line. Data is transferred Most Significant Bit (MSB) first. Data on the SDA line must remain stable during the high phase of the clock period, as shows below Each byte of data (including the address byte) is followed by one ACK bit from the receiver. The ACK bit (SDA “0” in 9 CLK high pulse) allows the receiver to communicate to the transmitter that the byte was successfully received I2C Communication Assembly Programming 1 Stop Bit Bit Start SCL SDA 1 2 3 4 5 6 7 8 9 ACK
  • 4. The following program uses the I2C communication to send a character to a display (NEWHAVEN, NHD‐0420D3Z‐ NSW‐BBW‐V3) Assembly Programming 2
  • 5. To read from a slave, the master must first instruct the slave which register it wishes to read from. This is done by the master starting off the transmission in a similar fashion as the write, by sending the address with the R/W bit equal to 0, followed by the register address it wishes to read from. Once the slave acknowledges this register address, the master will send a START condition again, followed by the slave address with the R/W bit set to 1. This time, the slave will acknowledge the read request, and the master releases the SDA bus, so that the slave can transmit data. The master will continue supplying the clock to the slave. At the end of every byte of data, the master will send an ACK to the slave, Once the master has received the number of bytes it is expecting, it will send a NACK, signaling to the slave to halt communications and release the bus. The master will follow this up with a STOP condition. The following program shows how to read a byte The following waveforms shows the process of programming the 16-Bit I/O Expander with I2C Interface: MCP-23017. ACK ACKACK ACKStart Stop Slave Address: 42H IODIRA: 00H Port A: Output Port B: Input R/W=0 Assembly Programming 3
  • 6. Writing to I2C: Sending 55H to Port A Reading from I2C: Getting value from Port B To attend a switch or button it is necessary to consider: ✓ Bounce time (10 msec) ✓ Press time (50 - 100 msec or greater) The pins of Ports 2 and 3 than have internal pull-ups must have 1s written to them, and in that state can be used as inputs. Two of the most common configurations of switch interface are shows below Switch/Led Assembly Programming Start Stop Slave Address: 42H Port A Address: 12H Value to Write: 55HACK ACK ACK R/W=0 R/W=0 ACK ACK ACK Slave Address: 42H Start Port B Address: 13H Start Slave Address: 43H R/W=1 Stop Read Value: 55H NACK 4
  • 7. Response time of button, key or switch: SW1 (“1” active), SW2 (“0” active) Getting value from Port B Assembly Programming 5
  • 8. 16-bit and 32-bit math routines can be used to extend the calculation capacity of the microcontroller, the most popular is the Application Brief AB-40 from INTEL. The 32-bit Math Routines can be useful to calculate equations in floating-point using equivalent calculation in fixed-point. The fundamental routines are: MUL_16, DIV_16, ADD_16, SUB_16, ADD_32, SUB_32. Fixed Point Arithmetic The Internal Temperature Sensor of ADuC842 has a voltage output of 700mV at 250C, with a variation of -1.4mV/0C. The Equivalent Voltage of a Hexadecimal Code in an ADC (12 bits, Vref = 2.5V) is: Voltage = 2.5*HEXADECIMAL_CODE/2^12 Using the above relations, after some Math, we can obtain the temperature equivalent to a Hexadecimal Code: Temperature = 525 – 0.436*HEXADECIMAL_CODE In order to avoid the floating-point arithmetic, we can obtain an equivalent relation using integer values: Temperature = (5250000 – 4360*HEXADECIMAL_CODE)/1000 >> 525 - 0.436*Cod_Hex ans = 25.3440 >> (5250000-4360*Cod_Hex)/1000 ans = 253.4400 Temperature from ADC Principal Program Temperature Calculation (32-bit Math) 32-bit Math Assembly Programming 6
  • 9. Serial Peripheral Interface (SPI) uses a four-wire serial bus: SS (Slave Select, Active Low): Specific to each slave. This is the pin that the SPI master use to enable the device. SCK (Serial Clock): The master generates the clock pulses that synchronize the data transmission. MOSI (Master Out Slave In) – This line is the master line for sending data to the SPI peripherals. MISO (Master In Slave Out) – This line is the slave line for sending data to the SPI master. Data Transmission (CPOL=0, CPHA=0): 1.- The master selects the slave by setting the SS pin of slave to low (SCK must be low). 2.- The master sends a bit on MOSI line and the slave reads it on the clock's low-to-high transition. The slave also sends a bit on the MISO line on the falling edge of the SCK, so that the data would be stable when read by the master on rising edges of SCK. 3.- When the transfer is complete, the master stops toggling the SCK and mostly pulls up the SS to deselect the slave. SPI Protocol Transferring 0A5H (MSB first) Assembly Programming SCK SS MOSI MISO MSB LSB 7
  • 10. Then, a new high to low transition is waited to detect the first bit. The value of a bit is sample each 900usec. In the 12 bits SIRC version, each word is sent LSB first as shown bellow The frames are repeated at an interval of 45msec, a minimum of 3 times. To assemble the input data, it’s necessary to wait the START pulse (high to low transition) and wait 2500usec IR Remote Control: SIRC Protocol S 0 1 2 3 4 5 6 0 1 2 3 4 8 1 Level Assembly Programming Start(5T) 0(2T)1(3T) Command (bits 0 - 6) Address (bits 0 - 4) T=0.6msec 0 Level
  • 11. IR Remote tester in Password Protected System Fundamental functions used to test the IR Remote Controller (RCA RCRN03BR, programmed code: 10810) KEYS_IDENT (KEYS_ID.asm): Output of IR Remote Controller WRITE_FLASH (Write_Flash.asm): Write 4 digits to Internal Flash Memory READ_FLASH_PASS (Read_Passw.asm): Read 4 digits from Internal Flash Memory PASSW_CHECK (Pass_check.asm): Read 4 digits from IR Remote VERY_PASSW (Windows_1.asm): Verify the Password (Internal Flash vs IR Remote) PASSW_NEW (Pass_check.asm): Read 4 digits from IR Remote PASSW_VERY (Pass_check.asm): Verify the Password (Enter and New Password) PASSW_DEF_RUT (PASS_INIT.asm): Initial Password and Flag Press this link for more information The power supply monitor monitors the power supply on the Microconverter. It indicates when any of the supply pins drops below one of two user selectable voltage trip points, 2.93 V and 3.08 V. Monitor function is controlled via the PSMCON SFR. If enabled via the IEIP2 SFR, the monitor interrupts the core using the PSMI bit in the PSMCON SFR. This bit is not cleared until the failing power supply has returned above the trip point for at least 250 msec. This monitor function allows the user to save working registers to avoid possible data loss due to the low supply condition and ensures that normal code execution does not resume until a safe supply level has been well established. Power Supply Monitor Assembly Programming 9
  • 12. The watchdog timer is a device that asserts a system reset or interrupt if it has not received a periodic pulse signal from a processor within a specific time frame. The processor periodically sends a pulse to the watchdog timer to indicate that the system software is operating properly. If the watchdog timer does not receive this pulse within an allotted time frame (known as the watchdog timeout), the watchdog timer asserts a reset. The watchdog timer is used to recover a microcontroller that has gone "out of control" due to power supply transients, electromagnetic interference, electrostatic discharge, etc. Incremental Rotary Encoders transduce rotational movement into electrical signals. If clockwise versus counterclockwise movement must be distinguished, two encoder outputs with a phase offset can accomplish this. Then the order of 2-bit states describes the direction turned, using a 90° phase offset (quadrature). Based on the feature size of an encoder, it can produce a different number of output states per revolution. When the quadrature encoder is rotating in a clockwise direction its signal will show Channel A leading Channel B, and the reverse will happen when the quadrature encoder rotates counterclockwise. The rotary Encoder may have a built-in switch Watchdog Timer Rotary Encoder Assembly Programming 10 De-Bounced BA=00 BA=01 BA=11 BA=10
  • 13. The sequence the encoder outputs while spinning clockwise is 00, 01, 11, 10 repeat. So if you have a reading of 01, the next reading can either be 00 or 11 depending on the direction the knob is turned. So by adding the previous encoded value to the beginning of the current encoded value we get: [BEFORE(BA)+CURRENT(BA)] CW: 0001(1H), 0111(7H), 1110(0EH), 1000(8H) CCW: 1011(0BH), 1101(0DH), 0100(4H), 0010(2H) Assembly Programming 11