Go Down

Topic: Answered: Unclear moment in sending data on serial (Read 649 times) previous topic - next topic


Apr 27, 2013, 08:50 pm Last Edit: Apr 28, 2013, 12:32 am by AlfaOmega Reason: 1
Hi all!

I'm making a programmable load. One of the steps is to make ATmega328 to talk to a MCP4921 DAC via serial interface.
The code that does the actual sending looks like this (courtesy of tronixstuff):

Code: [Select]
 outputValue = tAmps;
   digitalWrite(10, LOW);
   data = highByte(outputValue);
   data = 0b00001111 & data;
   data = 0b00110000 | data; //or data = 0b10110000 | data; to address the DACb
   data = lowByte(outputValue);
   digitalWrite(10, HIGH);

I do understand how this code does what it does, except for the "0b" part in the   "data = 0b00001111 & data;" line in a line just below it.
If you know please explain :)


0b means that the value to follow is in binary, not decimal, octal, or hex.


That part takes out the highest 4 bits of data using AND.
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter


Go Up