pl02

Files at this revision

API Documentation at this revision

Comitter:
cbaxte16
Date:
Tue Feb 23 14:35:55 2021 +0000
Commit message:
okay

Changed in this revision

delay_asm.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
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/delay_asm.S	Tue Feb 23 14:35:55 2021 +0000
@@ -0,0 +1,16 @@
+
+
+
+
+
+                AREA |.text|, CODE, READONLY    // tells assembler to make an AREA of machine code
+delay_asm       PROC                            //begin process  
+                EXPORT delay_asm                //gives code in other files permission to read this code
+                LDR R0, =0x0109676B             //Load register with word for a 0.6211972 second delay
+                MOV R1, #1                      // move 1 into R1
+loop            SUBS R0, R1                     //subtract R1 from R0 store result in Link-register
+                BNE loop                        // branch to loop if lr!= 0
+                BX LR                           //exit loop when lr == 0
+                ENDP                            //End procedure
+                ALIGN                           //aligns generated data to modulo-integer bytes
+                END                             //end routine   exit to C++
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 23 14:35:55 2021 +0000
@@ -0,0 +1,28 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2019 ARM Limited
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "mbed.h"   //CGB
+#include <iostream>
+
+// Blinking rate in milliseconds
+
+extern "C" void delay_asm(void);
+
+int main()
+
+{
+    set_time(0);
+    
+    time_t seconds = time(NULL);
+    // Initialise the digital pin LED1 as an output
+    DigitalOut led(LED1);
+
+    while (true) {
+        
+        delay_asm();
+        cout << seconds << "**\n\r";
+        
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Tue Feb 23 14:35:55 2021 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#0c6753bb821612eb72b5f682aed7ffcc98e80a1f