0

I am new to C and working with a serial device and I have this line:

short DA, DacData;    
DA=0xFFF;
DacData = ((channel&0x03)<<14)|((serialA&0x03)<<12)|(DA&0x6AA);

How do I increment only the last part of DacData (DA&0x6AA) in my loop? Thanks in advance!

1 Answers1

0

Try this:

DacData = ((channel&0x03)<<14)|((serialA&0x03)<<12) | ( (DA&0x6AA) + 1 );

Take into account that there is wrap around...

Israel Unterman
  • 13,158
  • 4
  • 28
  • 35