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
1
vote
1answer
58 views

Changing single bit in byte array

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

5-bit communication method?

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 ...
2
votes
2answers
52 views

How to control Shift registers output individually bitwise

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 ...
1
vote
1answer
46 views

Writing to partially reserved registers of sensors

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 ...
0
votes
1answer
52 views

Controlling LEDs with bit bang method

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 ...
3
votes
2answers
221 views

Form a signal from an array of bits

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 =...
1
vote
1answer
323 views

Print 2 numbers stored in 24-bits in decimal format

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 ...
1
vote
2answers
949 views

LSB/MSB and shiftOut

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++) { ...
1
vote
2answers
247 views

need to compare if a byte is less than 80 hex

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 ...
1
vote
1answer
129 views

How to split a binary data to form two split binary data?

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: ...
-1
votes
1answer
44 views

Control 4 digital outputs with one switch

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 ...
1
vote
1answer
1k views

USing arrays, binary data and bitRead

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, ...
1
vote
1answer
258 views

Bit Number to Byte Value conversion (AVR Docs)

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 ...
0
votes
1answer
160 views

MXCHIP IoT DevKit too many initializers for 'unsigned char [0]

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 ...
0
votes
2answers
311 views

Replace digitalWrite with a selective bitwise operation

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 = ...
3
votes
2answers
247 views

Testing Conditions on Port Bytes - ignoring certain bits?

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 ...
1
vote
4answers
5k views

Hex/Byte Reversing and Conversion

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]);...
-1
votes
1answer
1k views

transmit a sequence of bit using arduino uno [closed]

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 ...
0
votes
2answers
1k views

C++ Adding Two 16 bit binary numbers together

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] = {...
2
votes
3answers
300 views

Arduino status of bit

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
0
votes
1answer
501 views

How does Arduino UNO deal with bit shifting?

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. ...
1
vote
2answers
412 views

Encode & decode boolean values into a single integer?

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 ...
1
vote
2answers
213 views

Understanding bitwise operations [duplicate]

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 ...
0
votes
2answers
112 views

Overflow in bit calculation [closed]

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]; ...