Questions tagged [port-mapping]
Port-mapping refers to directly accessing the hardware registers (ports), in particular the input/output ports. Use this tag for discussing direct port access.
78 questions
11
votes
4
answers
21k
views
SAM3X8E (Arduino Due) Pin IO registers
How do the IO registers of Arduino Due work?
On Arduino Uno just set DDRx, then PINx to read, PORTx to write, I'd like to do the same thing with an Arduino Due, but it has many more registers, such as ...
4
votes
1
answer
15k
views
Arduino Uno R3 to Wemos D1 R2 project migration - Pinout problems
So i've chosen to purchase a Wemos D1 R2 board in order that my old Arduino Uno R3 projects can get some new IoT features. However, even if my code is working in Uno perfectly, i want to test it using ...
2
votes
4
answers
2k
views
Why do we use bitwise operators to assign PORTx, DDRx and Pinx?
I have come accross a lot of examples using ways similar to the ones shown below to assign values to the pins.
PORTB |= (1<<PORTB2); //set bit 2
PORTB &= ~(1<<PORTB1); //clear bit 1
...
2
votes
2
answers
7k
views
Is RX1 and TX0 the same thing as TX and RX? Will there be a difference in the way I program it?
I have an Arduino.
I'm not sure if RX1 and TX0 the same thing as TX and RX? Will there be a difference in the way I program it?
For example, do I treat RX1 and TX0 as RX and TX in the Arduino IDE ...
2
votes
1
answer
1k
views
Port manipulation in Arduino using byte value
I'm trying to write PORTB and PORTD in ATmega328P using byte system like this,
// PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
// N N N N N U U U
// 7 6 5 4 ...
2
votes
1
answer
562
views
While condition with & bitwise of PINx read
I was looking into ATmega32u4 datasheet to configure the SPI, and there is initialization snippet for data transmission.
void SPI_MasterTransmit(char cData)
{
/* Start transmission */
SPDR = ...
2
votes
1
answer
178
views
how to convert the following code into one using direct port manipulation
Following is the program for scanning a keyboard for MIDI transfer.
At present the code works fine, but it could be faster.
I need to know how to use direct port manipulation inside the for loop.
...
2
votes
1
answer
308
views
Atmega2560 PWM on PH4
I am trying to convert the following code to output to pin 7 (PH4, OC4B) on an Arduino Mega. The code outputs to pin 6. This code is from a GitHub for the GRBL on the Mega "https://github.com/...
2
votes
1
answer
3k
views
Windows stops recognizing Arduinos
I've just got my first Arduino Pro Mini and a USB to TTL chip. When I try to upload the program I get the message The uploader process failed followed by
avrdude: ser_open(): can't open device "\\.\...
2
votes
1
answer
1k
views
Mac Arduino IDE Connection to Min Seg (Mega 2560). No tty
I own a Macbook running OS X 10.10.3 (Yosemite)
I own a Min Seg.
My Min Seg model is built on an Arduino Mega 2560.
Problem
When I connect the board to the Macbook,
using either of the Macbook's ...
2
votes
0
answers
81
views
About Corrupted LM35 IC and Arduino port problem
I have one Arduino Uno which was working fine by below circuit(link):
But when I have connected the new bought the LM35 Ic by the below connection:
The Arduino UNO don't be recognized by the my ...
2
votes
0
answers
222
views
No Socket Available message floods serial monitor
Serial Monitor get's flooded with "No Socket Available" message. This seems to occur even before I Try to communicate with my Hue bridge through my hub port. Does anyone see why this is occurring ...
1
vote
1
answer
2k
views
What is the equivilent of PORTx for Teensy (4.0)?
I've seen people use code like PORTB |= 0x1 << 6 to set the sixth bit of PORTB in arduino. I understand that this is significantly faster than using digitalWrite. How can this be done using a ...
1
vote
1
answer
1k
views
USB-C to USB-C cable Arduino is not responding even not powered by this cable
Hi I want to connect arduino NANO to my laptop with Type-C (USB-C) ports (on below image left side [4] and other side 3). Now I bought a USB-C to USB-C cable, because it appeared to be the right tool, ...
1
vote
1
answer
2k
views
Pin toggle speed
If I use direct port manipulation, what is the average number of clock cycles it takes to flip a pin on the arduino
ie.
void loop(){
PORTB |= 0b00010000;
PORTB &= ~0b00010000;
}
So how fast ...
1
vote
1
answer
4k
views
How to determine which pins_arduino.h file is used?
For some applications I need access to the registers that control the output/input and high/low state of pins. For example pin 10 on a adalogger is PORTB with a mask of _BV(6). This information can ...
1
vote
2
answers
144
views
Why does "!=LOW" != "HIGH"?
I'm learning about accessing ports directly on the ATMEGA 328 using an Arduino Uno. The program sets up pin 13 as an output and pin 2 as an input. I then enable the pull up resistor on pin 2.
I read ...
1
vote
1
answer
204
views
Why my arduino board does not blink properly?
I have two files
blink1.cpp
typedef unsigned char int8_t;
typedef volatile int8_t * volatile port_type;
port_type portB = (port_type) 0x25;
port_type ddrB = (port_type) 0x24;
void delay_500ms()
{
...
1
vote
1
answer
531
views
Can I disable the TX pin by setting its mode to INPUT while still receiving data on the RX pin of a UART?
I'm using the ATmega328PB in a personal project with MiniCore. My board streams data in on the RX pin from another microcontroller, but my board also has a DIP switch connected to the TX pin, that's ...
1
vote
1
answer
2k
views
ADC port manipulation
I was modifying this ADC Touch implementation, namely switching analogRead and pinMode to what I thought would be port manipulation equivalents.
I get very different readings (better and more stable ...
1
vote
5
answers
6k
views
Arduino Nano (clone) not recognized
Asking here cause I ran out of options in searching. My Arduino Nano clone isn't recognized by my computer anymore. It was, until I plugged into a Windows machine, that did not recognize it... and now ...
1
vote
1
answer
177
views
Unable to use rising edge interrupt for external clock Arduino 2650
I'm messing about with an Arduino Mega2560r3 and failing to get timer 4 to trigger on the rising edge of an external clock. It only ever triggers on the falling edge.
I've tried
TCCR4B = (1 <&...
1
vote
1
answer
998
views
Output specific value using port manipulation
How can I output a specific value on a pin using port manipulation?
Example: I want to use this code but without any arduino functions, just with port manipulation:
for (int i = 0; i < 255; i++){
...
1
vote
1
answer
412
views
No sketches will upload to Arduino Uno board; says "access denied"
I'm using an Arduino Uno board with an HP computer running Windows 10 and IDE version 1.6.8. Arduino was working fine for me until a few days ago, when (and I suspect this is the root of the problem) ...
1
vote
0
answers
715
views
Can't upload to nano esp32
Recently bought a nano esp32 to play around with the small size and wifi module. However I'm plagued by the No DFU capable USB device available message.
My efforts and deductions:
I can connect to ...