.thumb
.syntax unified

my_asm:
        ldr r1, =0x2009C020
        mov r0, #0x040000
        str r0, [r6]
//
//ARMAssemblylanguagefunctiontosetLED1bittoavaluepassedfromC
//LED1getsvalue(passedfromCcompilerinR0)
//LED1isonGPIOport1bit18
//SeeChapter9intheLPC1768UserManual
//foralloftheGPIOregisterinfoandaddresses
//Pinnames.hhasthembedmodulespinportandbitconnections
//
//LoadGPIOPort1baseaddressinregisterR1
//LDRR1,=0x2009C020
//0x2009C020=GPIOport1baseaddress
//MovebitmaskinregisterR2forbit18only
//MOV.WR2,#0x040000//0x040000=1<<18all"0"switha"1"inbit18
//valuepassedfromCcompilercodeisinR0-comparetoa"0"
//CMPR0,#0//value==0?
//(If-Then-Else)onnexttwoinstructionsusingequalcondfromthezeroflag
//ITEEQ
//STOREifEQ-clearled1portbitusingGPIOFIOCLRregisterandmask
//STREQR2,[R1,#0x1C]//if==0,clearLED1bit
//STOREifNE-setled1portbitusingGPIOFIOSETregisterandmask
//STRNER2,[R1,#0x18]//if==1,setLED1bit
//ReturntoCusinglinkregister(BranchindirectusingLR-areturn)
//BXLR
//END
