|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
How can I create a program that reads and modifies a port pin using the values of the input pins rather than the values of the output latch?
The ORL instruction will let me set a pin on a port, however, it reads the value of the output latch rather than the values of the input pins.
The MOV, ORL, MOV instruction sequence is that I need to get.
This is easily done in C using the Keil compiler. The following example demonstrates this:
unsigned char P1_copy; P1 |= 0x80; // Generate ORL P1, 0x80 P1_copy = P1; // Generate MOV, ORL, MOV sequence P1 = P1_copy | 0x02;
The generated code is shown below:
0000 439080 ORL P1,#080H 0003 AF90 MOV R7,P1 0005 EF MOV A,R7 0006 4402 ORL A,#02H 0008 F590 MOV P1,A
Article last edited on: 2007-01-31 11:55:40
Did you find this article helpful? Yes No
How can we improve this article?