bits manipulation (BME)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

bits manipulation (BME)

1,215 Views
silviopistolesi
Contributor II

i must read a word of 16 bits from PORTC to load in memory buffer but the PORTC haven't bit 14 and 15 but 16 and 17. For format the word in 16 bit I make in the folloving mode:

read_data = FGPIOC_PDIR;

tmp = read_data & 0x00030000;

tmp = tmp >> 2;

read_data = read_data | tmp;

There is an other mode (less instructions and/or faster) for to do the same operations?

Tags (3)
1 Reply

952 Views
Paul_Tian
NXP Employee
NXP Employee

Hi, Silvio

After compared with our BME sample code, I think your code is OK. After convertion to assembly code, the instruction lines are same.

Hope my reply can help you.

Best Regards

Paul