Skip to main content

Questions tagged [bit]

A bit (short for binary digit) is the smallest unit of data in a computer. A bit has a single binary value, either 0 or 1. Although computers usually provide instructions that can test and manipulate bits, they generally are designed to store data and execute instructions in bit multiples called bytes.

Filter by
Sorted by
Tagged with
0 votes
1 answer
102 views

I know I'm missing something so simple here, but I can't figure it out. If I do char letter = 'A'; then letter = letter << 8, letter = 0, as one should expect, since we are shifting the bits &...
AJ_Smoothie's user avatar
3 votes
1 answer
216 views

In my code I have a number of boolean flags that tell me if data has been written to specific places in the EEPROM. I need to save these flags to the EEPROM and recover them on a restart. Is the ...
BRUCE DURANT's user avatar
2 votes
0 answers
391 views

I'm try to read some value from a soil NPK sensor using RS485 Modbus e Arduino uno. I menage to sent the request msg and I got the response but now i don't know how to read the response in order to ...
Damiano Miazzi's user avatar
1 vote
2 answers
95 views

What is the below Arduino code doing? I am not familiar with the '+' with regard to bitwise operations. Just getting familiar with this stuff. return ((four << 0) & 0xFF) + ((three << ...
fmarquet's user avatar
1 vote
1 answer
150 views

ADMUX = ADMUX | _BV(REFS); // uncompounded bitwise OR ADMUX |= _BV(REFS0); // #define _BV(bit) (1 << (bit)) ADMUX |= bit(REFS0); // #define bit(b) (1UL << (b)) bitSet(...
Gaai's user avatar
  • 55
1 vote
1 answer
182 views

I'm using a Teensy 3.2 to read data from an ADXL375 using SPI. In general the communication is going just fine and I can activate settings etc. However, when I try to read X, Y or Z data it seems like ...
daniel's user avatar
  • 185
3 votes
1 answer
3k views

So I have a byte-array representing the display attached to my Arduino: byte theDisplay[8] = { B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, ...
gurkensaas's user avatar
-1 votes
2 answers
110 views

OK, I'm working on a project where I want to have multiple toggle switches create a "code" to determine further actions. This is essentially 5-bit communication process that will create ...
Mulcch's user avatar
  • 19
2 votes
2 answers
1k views

so i am working on a project which needs a lots of bit manipulation and shifting out the bits to control the pins of shift registers individually. So i am using 2 shift registers daisy chained with 16 ...
Subha Jeet Sikdar's user avatar
1 vote
1 answer
182 views

I'm trying to change the range of a gyroscope I'm using and there is the following guideline: it is recommended to mask out (logical and with zero) reserved bits of registers which are partially ...
Zhelyazko Grudov's user avatar
0 votes
1 answer
487 views

I'm doing a research for RGB LED chips that MCU can control with one pin. I found this LED chip and it seems controlling LEDs is not as I've tought. I understand hardware part, software side is a ...
Pararera's user avatar
  • 213
3 votes
2 answers
529 views

I need to reproduce with a digital pin of an Arduino such a key in the form of a sequence of 1's and 0's, where a one takes 2 ms high and 2 ms low, and a zero takes 1 ms high and 1 ms low. int key =...
Антон's user avatar
1 vote
1 answer
743 views

An implementation function from the nice little Wiegand library YetAnotherArduinoWiegandLibrary prints a hexadecimal representation of a facility # & card # (8-bit facility #, 16-bit card #) — 24 ...
micahwittman's user avatar
1 vote
2 answers
4k views

Here is the shiftOut function code from wiring_shift.c void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) { uint8_t i; for (i = 0; i < 8; i++) { ...
Kekers_Dev's user avatar
1 vote
2 answers
575 views

I am using an infrared sensor called OTI301. In its data sheet it says that in order to obtain object temperature and ambient temperature values I need to extract the binary information from the ...
Santiago Restrepo Serna's user avatar
1 vote
1 answer
426 views

I want to split a received binary data into two binary data. Take the following received binary data for instance: uint32_t data = 0xFFFF0001; In binary format it is: ...
floppy380's user avatar
  • 245
-1 votes
1 answer
93 views

I want to control 4 digital outputs (d0, d1, d2, d3) with one switch. When the Arduino starts, they should all be in state LOW. Now, after pressing the button once, d0 should get HIGH. Another push ...
pfra's user avatar
  • 1
1 vote
1 answer
4k views

This is my first manually typed code. I'm sure there may be some glaring "schoolboy errors" in it, so wondered if people could give it the 'once over' In particular, I have never used C++ arrays, ...
Cristofayre's user avatar
1 vote
1 answer
561 views

I have hard time to understand what this doc tells me: https://www.microchip.com/webdoc/AVRLibcReferenceManual/FAQ_1faq_use_bv.html I has a macro called _BV that convert a bit number (usually ...
xetra11's user avatar
  • 167
0 votes
1 answer
353 views

Question Trying to call the Display draw API using the sample code for the azure logo bitmap sample code. I'm unable to reach a point where I can the API because breaks when constructing the bitmap ...
greg's user avatar
  • 103
0 votes
2 answers
664 views

I have the following code with digitalWrite I aim to write with bitwise operation only. No portability concerns here whatsoever. (for atmega328p here) #define DATAOUT 11//MOSI byte commandbits = ...
Noel's user avatar
  • 163
3 votes
2 answers
347 views

Being new to testing byte and bit conditions, I feel like there has to be a better way to test for conditions/values on a byte (read from a port). For example, I'm reading 8 bits from PORTK. I need ...
Coyttl's user avatar
  • 133
1 vote
4 answers
8k views

I'm working on an RFID system using a MFRC522 with this Library : https://github.com/miguelbalboa/rfid Here's the code I have right now: int A=(mfrc522.uid.uidByte[0]); int B=(mfrc522.uid.uidByte[1]);...
AlfroJang80's user avatar
-1 votes
1 answer
2k views

How do i code to transmit a sequence of bit using arduino uno?My project is about a transmitter and a receiver.Arduino as the transmitter and an application as the receiver.Light sensor will detect ...
Nyssa's user avatar
  • 15
1 vote
2 answers
2k views

I am trying to add two 16 digit binary numbers together. Each binary number will have been entered by the user and saved as: int binaryOne[16] and int binaryTwo[16]. Originally, int binaryOne[16] = {...
Katie's user avatar
  • 43
2 votes
3 answers
1k views

Is the a way to check the status of a bit in an arduino Uno? Like how in Atmel AVR, there is bit_is_clear or bit_is_set
JoeyB's user avatar
  • 119
0 votes
1 answer
809 views

Explanatory comment: I'm a beginner. I'm examining the feasibly of bit shifting to the right 6 places to divide up the range of the Arduino ADC (has a range of 0 to 1023) to something much smaller. ...
R R.'s user avatar
  • 1
1 vote
2 answers
694 views

I'm trying to record the state of some pins over time. To save memory, I'm thinking about encoding the pin states into a single integer, like this: Pin 1: TRUE Pin 2: FALSE Pin 3: FALSE Pin 4: TRUE ...
Esshahn's user avatar
  • 217
1 vote
2 answers
348 views

I am wondering what the second line of code does: int16_t GyX; GyX=Wire.read()<<8|Wire.read(); Also, how can I write the GyX value to EEPROM? From what I understand, int16_t is a two-bytes ...
Petio Petrov's user avatar
0 votes
2 answers
165 views

I'm having a double buffer to write data from sensors to SD card. inBuf points to the buffer that are written into (from sensors). The other buffer write data to SD card. char buffer[2][BUFLEN]; ...
Dzung Nguyen's user avatar