??? 03/06/09 10:12 Read: times |
#163148 - Your test simulates as 41.04us Responding to: ???'s previous message |
For a NXP LPC2103
#define FIO_PIN ((unsigned char *) &FIOPIN) unsigned short us; unsigned char buf[257]; for (us = 1; us < 257; ) FIO_PIN[2] = buf[us++]; // byte addressing bits 16..23 This simulates as 41.04us. I have not tried it in real life, and I suspect that the hardware would not respond at that speed. Looking at the ASM generated, the code could be made a lot more efficient. ARM compiles do not like byte-addressing the Fast i/o ports as a general rule. 164: for (us = 1; us < 257; ) 0x00000600 E3A04001 MOV R4,#0x00000001 0x00000604 EA000006 B 0x00000624 165: FIO_PIN[2] = buf[us++]; 0x00000608 E1A00004 MOV R0,R4 0x0000060C E2841001 ADD R1,R4,#0x00000001 0x00000610 E3C14801 BIC R4,R1,#0x00010000 0x00000614 E28D1000 ADD R1,R13,#0x00000000 0x00000618 E7D10000 LDRB R0,[R1,R0] 0x0000061C E51F1048 LDR R1,[PC,#-0x0048] 0x00000620 E5C10016 STRB R0,[R1,#0x0016] 0x00000624 E3540C01 CMP R4,#0x00000100 0x00000628 DAFFFFF6 BLE 0x00000608 You could equally well do the same operation with the FIOSET, FIOCLR registers or the IOSET, IOCLR . In which case you can write to the whole 32 bit GPIO port in one go. David. p.s. I am NOT experienced with ARMs. There MAY be a deliberate error here. |