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.
main.cpp
00001 /*Program Example 14.1: Sets up a digital output pin using control registers, and flashes an led. 00002 */ 00003 // function prototypes 00004 void delay(void); 00005 00006 //Define addresses of digital i/o control registers, as pointers to volatile data 00007 #define FIO2DIR0 (*(volatile unsigned char *)(0x2009C040)) 00008 #define FIO2PIN0 (*(volatile unsigned char *)(0x2009C054)) 00009 00010 int main() { 00011 FIO2DIR0=0xFF; // set port 2, lowest byte to output 00012 while(1) { 00013 FIO2PIN0 |= 0x01; // OR bit 0 with 1 to set pin high 00014 delay(); 00015 FIO2PIN0 &= ~0x01; // AND bit 0 with 0 to set pin low 00016 delay(); 00017 } 00018 } 00019 //delay function 00020 void delay(void){ 00021 int j; //loop variable j 00022 for (j=0;j<1000000;j++) { 00023 j++; 00024 j--; //waste time 00025 } 00026 } 00027
Generated on Mon Jul 25 2022 20:12:43 by
1.7.2