Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Revision 3:2ec663c724ea, committed 2020-12-07
- Comitter:
- mcharrison17
- Date:
- Mon Dec 07 18:45:28 2020 +0000
- Parent:
- 2:a38c09fad0fe
- Child:
- 4:febba9dd921b
- Commit message:
- Updated code
Changed in this revision
| PROGRAM4_F20_Harrison.s | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/PROGRAM4_F20_Harrison.s Mon Dec 07 04:03:14 2020 +0000
+++ b/PROGRAM4_F20_Harrison.s Mon Dec 07 18:45:28 2020 +0000
@@ -4,45 +4,43 @@
;int32_t CountItems()
CountItems ; get max num of words
- MOV R4, #0 ; track num of words
- ADR R1, table ; get address of beginning of table
- LDR R2, [R1] ; get value at address of beginning of table
- MOV R3, #12 ; use to move to next word in table
+ MOV R0, #0 ; track num of words
+ LDR R1,= table ; get address of beginning of table
+ MOV R3, #14 ; use to move to next word in table
+ LDR R2, [R1, R3] ; move R3 num of bytes in the table
B getWordCount
getWordCount
CMP R2, #0 ; compare value in table to 0
BEQ leave1
- ADD R4, R4, #1 ; add 1 to num of words
+ ADD R0, R0, #1 ; add 1 to num of words
LDR R2, [R1, R3] ; move R3 num of bytes in the table
- ADD R3, R3, #12 ; add 12 bytes to R3
+ ADD R3, R3, #14 ; add 14 bytes to R3
B getWordCount ; loop back
-leave1
- MOV R0, R4
+leave1
BX LR
GLOBAL SumAllFrequencies
;int32_t SumAllFrequencies()
SumAllFrequencies
- MOV R4, #0 ; track frequency num
- ADR R1, table ; get address of beginning of table
- MOV R3, #8 ; use 8 to account for word being first in table
- LDR R2, [R1, R3] ; get value where first frequency is stored in table
- ADD R3, R3, #12 ; use to move to next frequency in table
+ MOV R0, #0 ; track frequency num
+ LDR R1,= table ; get address of beginning of table
+ MOV R3, #12 ; use 12 to account for word being first in table
+ LDRH R2, [R1, R3] ; get value where first frequency is stored in table
+ ADD R3, R3, #14
B getFrequencyCount
getFrequencyCount
CMP R2, #0 ; compare value in table to 0
BEQ leave ; break because looped through entire table
- ADD R4, R4, R2 ; add current frequency to total frequency
- LDR R2, [R1, R3] ; move R3 num of bytes in the table
- ADD R3, R3, #12 ; add 12 bytes to R3
+ ADD R0, R0, R2 ; add current frequency to total frequency
+ LDRH R2, [R1, R3] ; move R3 num of bytes in the table
+ ADD R3, R3, #14 ; add 14 bytes to R3
B getFrequencyCount ; loop back
leave
- MOV R0, R4
BX LR
GLOBAL GetWordAt
@@ -52,14 +50,14 @@
MOV R1, #1
ADR R2, table ; get address of beginning of table
LDR R3, [R2] ; get value at address of beginning of table
- MOV R4, #12 ; use to move to next word in table
+ MOV R4, #14 ; use to move to next word in table
B findWord
findWord
CMP R1, R0 ; compare 1 to i
BEQ wordFound ; break because word found
LDR R3, [R2, R4] ; move R4 num of bytes in table
- ADD R4, R4, #12 ; add 12 bytes to R3
+ ADD R4, R4, #14 ; add 14 bytes to R3
ADD R1, R1, #1
B findWord
@@ -90,23 +88,23 @@
MOV R0, R4
BX LR
-stop B stop
-
+ ALIGN
table DCB "pie",0
- SPACE 4
+ SPACE 8
DCW 34
- SPACE 2
+
DCB "cake",0
- SPACE 3
+ SPACE 7
DCW 29
- SPACE 2
+
DCB "souffle",0
+ SPACE 4
DCW 22
- SPACE 2
+
DCB "cookie",0
- SPACE 1
+ SPACE 5
DCW 15
- SPACE 2
+
DCB 0
END
\ No newline at end of file
--- a/main.cpp Mon Dec 07 04:03:14 2020 +0000
+++ b/main.cpp Mon Dec 07 18:45:28 2020 +0000
@@ -44,7 +44,7 @@
{
lcd.Clear(LCD_COLOR_RED);
lcd.SetBackColor(LCD_COLOR_RED);
- lcd.SetTextColor(LCD_COLOR_WHIT);
+ lcd.SetTextColor(LCD_COLOR_WHITE);
lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE);
lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"INIT FAIL", CENTER_MODE);
}
@@ -66,18 +66,20 @@
uint8_t *word;
int16_t wordfrequency;
float percentage;
+ int32_t MAX;
+ int32_t totalfrequency;
- int32_t MAX = CountItems();
+ /*MAX = CountItems();
sprintf((char*)text, "MAX=%d", MAX);
- lcd.DisplayStringAt(0, LINE(3), (uint8_t *)&text, LEFT_MODE);
- int32_t totalfrequency = SumAllFrequencies();
+ lcd.DisplayStringAt(0, LINE(3), (uint8_t *)&text, LEFT_MODE);*/
+ totalfrequency = SumAllFrequencies();
sprintf((char*)text, "totalfrequency=%d", totalfrequency);
lcd.DisplayStringAt(0, LINE(4), (uint8_t *)&text, LEFT_MODE);
while(1)
{
- button_callback();
+ /*button_callback();
for(int32_t i = 1; i < (MAX + 1); i++){
word = GetWordAt(i);
wordfrequency = GetFreqAt(i);
@@ -85,6 +87,6 @@
sprintf((char*)text, "word=%d", word);
lcd.DisplayStringAt(0, LINE(5), (uint8_t *)&text, LEFT_MODE);
}
- wait(1);
+ wait(1);*/
}
}