Docsity

Morse Code Subroutine and Port Configuration for SOS Transmission, Exercises of Microcontrollers

Toggle sidebar
bg1
EEE20003 Tutorial - 5
1. You have been asked to automate the process of sending the emergency Morse code sequence for SOS. You
are provided with the following information about Morse code:
• Morse code messages are made up of combinations of short and long pulses usually referred to
as dot and dash.
• Each letter in the alphabet has a unique sequence of dots and dashes. The codes for the two letters
needed for the message SOS are:
S = dot-dot-dot
O = dash-dash-dash.
• A dash is three times the length of a dot.
• The space between a dot/dash and another dot/dash in the same letter is equal to a dot
length.
• The space between two letters is equal to 3 dots length.
• The space between two words is equal to 5 dots length.
• The message SOS is treated as a word.
You are to write the required program as C code to do the basic port initialisation but to use assembly language
to do the actual transmission of the data.
Write an assembly language subroutine to send the word “SOS” using an LED connected as shown above. The
subroutine should include the end of word delay at the end of the SOS. The subroutine should be callable from a
C program using the prototype void sendSOS(void).
You may assume the existence of a delay routine delayDot that delays for 1 dot time.
Incorporate this subroutine into a complete program that will continuously send the message as long as the
button shown above is pressed.
NOTE: Other pins of the port may be in use.
pf2

Partial preview of the text

Download Morse Code Subroutine and Port Configuration for SOS Transmission and more Exercises Microcontrollers in PDF only on Docsity!

EEE20003 Tutorial - 5

  1. You have been asked to automate the process of sending the emergency Morse code sequence for SOS. You are provided with the following information about Morse code: - Morse code messages are made up of combinations of short and long pulses usually referred to as dot and dash. - Each letter in the alphabet has a unique sequence of dots and dashes. The codes for the two letters needed for the message SOS are: S = dot-dot-dot O = dash-dash-dash. - A dash is three times the length of a dot. - The space between a dot / dash and another dot / dash in the same letter is equal to a dot length. - The space between two letters is equal to 3 dots length. - The space between two words is equal to 5 dots length. - The message SOS is treated as a word.

You are to write the required program as C code to do the basic port initialisation but to use assembly language to do the actual transmission of the data. Write an assembly language subroutine to send the word “SOS” using an LED connected as shown above. The subroutine should include the end of word delay at the end of the SOS. The subroutine should be callable from a C program using the prototype void sendSOS(void). You may assume the existence of a delay routine delayDot that delays for 1 dot time. Incorporate this subroutine into a complete program that will continuously send the message as long as the button shown above is pressed. NOTE: Other pins of the port may be in use.

EEE20003 Tutorial - 5

  1. What will the content of Port A be after executing the following sequence? Assume Port A initially contains 0x00000000.

.equ GPIOA, 0x400FF .equ PTOR_OFFSET,0x0C .equ PDDR_OFFSET,0x

ldr r1,=GPIOA mov r0,#0x00FF str r0,[r1,#PDDR_OFFSET] mov r0,#0x000F str r0,[r1,#PTOR_OFFSET

  1. Write a subroutine that generates 0.5 second delay without using the timer operation. Provide your calculation.