.thumb
.syntax unified
// Equates
        .equ GPIOC_CRH,   0x40011004
        .equ GPIOC_ODR,   0x4001100C
        .equ RCC_APB2ENR, 0x40021018
        .equ STACKINIT,   0x20005000

        .equ LEDDELAY,    800000

my_asm:
	mov	R1,#0
	ldrR1,=0x2009C020
//
//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
