Hello Friends,
I have to read 16-bit data from Port 0 of LPC2129.But the data is not available on consecutive pins. So I assigned a name to each pin like PDB0. To read all 16 bits into a single byte I wrote the following macro to use in my code:
#define DigitalData1() (PDB0|PDB1<<1|PDB2<<2|PDB3<<3|PDB4<<4|PDB5<<5|PDB6<<6|PDB7<<7|PDB8<<8) #define DigitalData2() (PDB9<<9|PDB10<<10|PDB11<<11|PDB12<<12|PDB13<<13|PDB14<<14|PDB15<<15) #define DigitalData() ( DigitalData2() | DigitalData1())
I use DigitalData() to get the 16 bit word into a local variable like this:
ADC7606DataBuff = DigitalData();
Problem here is, this is eating good amount of time to process.
Can you suggest be what is the best way of coding to handle this kind of issues??
Thanks very much!
Hardware was already designed by someone. I am left with no option, expect finding a good way of writing some efficient programs, to reduce system overhead...