Source Code : Table 3.2 ;Program written using C++ for mbed LPC11U24 board int main() { ;This program will lit 8 LEDs interfaced at GPIO pins, while(1) { showing ;hexadecimal counting pattern from 0 to 65535( for(int i=0; i<65535; i++) { FFFFh). ledchk = !i; ;Outputs given here as port and not as bits. wait(0.05); } #include "mbed.h" } BusOut ledchk(p21,p22,p23,p24,p25,p26,p29,p30); } Interfacing of push to on switch: Connect switch as per connections given in Figure 3.2 Write the desired C++ source code and compile using online compiler as described in experiment1. Figure 3.2 Interfacing of push to on switch at GPIO p35 Source Code : Table 3.3 ;Program written using C++ for mbed LPC11U24 board int main() { ;This program will toggle onboard LED1, for every switch while(1) { press if(switchpress) { ; switch connected at GPIO pin, p35. led = !led; } #include "mbed.h" wait(0.25); DigitalIn switchpress(p35); } DigitalOut led(LED1); } Result:- Output observed at GPIO pins. LEDs and switch interfacing achieved at GPIOs as per compiled C++ source code. Conclusion :- Small changes in source code may result in saving memory space and programmers efforts tremendously. Any available GPIO can be combined to form I/O port. This ease of programming is Remark :- provided by mbed board and not by ARM processor. Reference:-
Source Code : Table 3.2 ;Program written using C++ for mbed LPC11U24 board ;This program will lit 8 LEDs interfaced at GPIO pins, showing ;hexadecimal counting pattern from 0 to 65535( FFFFh). ;Outputs given here as port and not as bits. #include "mbed.h" BusOut ledchk(p21,p22,p23,p24,p25,p26,p29,p30); int main() { while(1) { for(int i=0; i<65535; i++) { ledchk = !i; wait(0.05); } } } Interfacing of push to on switch: Connect switch as per connections given in Figure 3.2 Write the desired C++ source code and compile using online compiler as described in experiment1. Figure 3.2 Interfacing of push to on switch at GPIO p35 Source Code : Table 3.3 ;Program written using C++ for mbed LPC11U24 board ;This program will toggle onboard LED1, for every switch press ; switch connected at GPIO pin, p35. #include "mbed.h" DigitalIn switchpress(p35); DigitalOut led(LED1); int main() { while(1) { if(switchpress) { led = !led; } wait(0.25); } } Result:- Output observed at GPIO pins. LEDs and switch interfacing achieved at GPIOs as per compiled C++ source code. Conclusion :- Small changes in source code may result in saving memory space and programmers efforts tremendously. Remark :- Any available GPIO can be combined to form I/O port. This ease of programming is provided by mbed board and not by ARM processor. Reference:-