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.

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

Valid options for output port on Mega 2560

I would like to adopt this library on an Arduino Mega2560: https://github.com/gueei/DShot-Arduino However, the macro DSHOT_PORT needs defined for the Mega2560 here: https://github.com/gueei/DShot-...
1
vote
2answers
63 views

Can't upload code to Arduino board on Mac

I'm using a MacBook Pro with 10.13.6, an Official Arduino Uno Board and Arduino 1.8.13 IDE. I'm having troubles uploading code to the Arduino Board. I have 5 ports available: dev/cu.-AvnetaSPPPort ...
0
votes
1answer
43 views

Port manipulation

My UNO having some stability issues because of heavy memory use, I'm now optimizing the code now looking to reduce the digital read memory use with the help of port manipulation. I got the code for ...
2
votes
4answers
343 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 ...
3
votes
1answer
49 views

problems with Blue Pill (stm32f103c8t6) direct register manipulation

I'm trying to access registers but I keep getting the "was not declared in this scope" error message. I'm currently using the STM32F1xx boards from http://dan.drown.org/stm32duino/...
1
vote
3answers
59 views

ATMega328 functions, but will not output to any pins

Problem: ATMega328 Refuses to digitalWrite() to any pins, I can upload and run sketches using the board UNO from the ide on the 328 and can confirm it is working using the serial monitor (see code). I ...
2
votes
1answer
52 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. ...
0
votes
0answers
37 views

Port manipulation: Coding for two chips

I am using Arduino Nano to test a code that will be ported on an ATTiny chip, which will need to perform operations at a frequency near clock maximum, calling for a very succinct coding. My goal: to ...
1
vote
1answer
249 views

Can analog pins be defined as either their analog name (A0) or their digital pin number?

Can analog pins be defined by their digital pin number, and be used for analog purposes? For example, instead of defining A0 for a pinout with the Uno, it could be 14? Where is this documented? Is ...
-1
votes
1answer
89 views

Data in two 8 bit shift registers won't change

I'm trying to output 16 bits of data to two 8 bit shift registers (74HC595), which drive a 8x8 led matrix. There is a problem with the way the code outputs data to the registers, its like no data is ...
0
votes
0answers
43 views

How can I add PWM to my BLDC code using port manipulation?

I have the following code, which currently uses 6 output pins (pins 8 - 13) from the Arduino to my inverter circuit, which controls a BLDC motor. The code is fine and it works, however I want to add ...
2
votes
1answer
380 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 ...
0
votes
0answers
57 views

How to specify pin in Servo library?

Here's what caused the original confusion. As one know, Arduino nano and UNO use analog pin as PWM pins, while Arduino Mega use digital pin output as the PWM pins, which this webpage ignored to ...
0
votes
1answer
57 views

Reading port register and print

I am playing with port registers directly to improve speed on a Arduino micro. I have no problem writing them, like PORTF &= B11101111 However, when I try to read and print it, things get funny ...
0
votes
1answer
124 views

Can't get OC1B (pin 10) to output

I'm trying to get this program to use channel B for the output waveform using the phase correct PWM mode and using OCR1A as the top. With a 50% duty ratio I'm attempting to get a 10 Hz freq. I'm able ...
0
votes
0answers
67 views

MKR 1000 not found in ports when MKR IMU Shield is connected

I am trying to connect my MKR IMU Shield to my MKR1000 by placing the IMU shield in the MKR1000. When I do this, however, the Arduino IDE and Simulink are unable to find the port that my Arduino is ...
0
votes
1answer
135 views

Pin Mappings from Arduino Metro M4 Express Board to SAMD51

After looking through the internet, I coudln't find any document (not in the datasheet, no nice graphics on google image searches) that showed the mapping between the Arduino breakout board and the ...
-1
votes
1answer
1k views

How come some Arduino Nano pins (D3, D4, A3, A4, A6, A7) cannot be set high?

I made a sketch to switch on all digital and analog pins, and found out several pins did not work as expected. Note: I manually put a jumper wire from each digital and analog pin (one at a time) to a ...
1
vote
1answer
33 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
0answers
222 views

Reading data by port manipulation (Arduino Due)

I have shorted the 23rd pin of port A with 3.3v output pin (i.e. tieing 23rd pin of port A to logic high). Now I am trying to read the 23rd pin of port A by using following code- void setup() { ...
0
votes
2answers
129 views

Sharing serial output from one to many arduinos (plus a computer) via USB hub

I am trying to send rotary encoder output from an UNO to seven Trinket M0s and a computer via a (powered) USB hub. Currently the UNO → Laptop bit works great, serial monitoring works via the hub ...
1
vote
0answers
36 views

Arduino Port randomly changes whenever I punch correct RFID tag

I was working on an Electronic Door Lock/Unlock system using Arduino Uno and RFID Reader/Tags on Ubuntu 18.04.02 lts. Now the problem is that whenever I punch-in the correct RFID tag to the RFID ...
0
votes
1answer
171 views

Converting code for ATTINY85 to ATMEGA2560. Pin change interupts

I have code that compiles correctly for an ATTINY85 board using the ARDUINO IDE but I don't have an ATTINY85 board. I have an Arduino Mega ATMEGA2560 and when I select this board in the Arduino IDE ...
-1
votes
2answers
663 views

Reading a rotary encoder using digital pins of Mega 2560 directly using port registers?

I'm trying to write an interrupt service routine for an Arduino Mega 2560 to decode a quadrature rotary encoder. I've got an ISR (Interrupt Service Routine) that responds to the falling edge of ...
1
vote
0answers
140 views

Bit Bang I2C with port manipulation on AtTiny84: new pinout doesn't work

So I am trying to understand bit banging and port operations. I'm developing a breakout board with an ADXL343 IMU read by an AtTiny44 via i2c. I adapted this code from MIT's How To Make Almost ...
0
votes
0answers
106 views

How to choose a port on Arduino Create

I have connected my Mega2560 Arduino to my computer; locally everything works fine - I have been able to upload and run programs. However, on Arduino Create, it shows that there's no connection to my ...
0
votes
1answer
597 views

Two ports on Uno with ethernet shield

I am making an Arduino mod-bus device and I want to make a webpage as well that will allow me to reset the unit if there is any issues remotely. To do this I would need the mod-bus to operate on port ...
-1
votes
2answers
116 views

Why does attaching Nokia 5110 LCD make my otherwise fine MKR1000 disconnect USB after 15 secs?

This problem just started after 3 days of working on a project. I am using Arduino IDE in Windows 10. When I go to upload "Blink," everything works fine. I connect the USB (sometimes I have to ...
1
vote
1answer
86 views

Switch two or more digital outputs of ESP8266 at the same time [closed]

I'd like to control some digital ICs with a ESP8266-12. How can I switch 2 pins to HIGH in the same moment? How can I switch one to LOW and the other to HIGH in the same moment? Is it possible with ...
0
votes
1answer
550 views

What is the best way to configure a bidirectional, open collector data pin? [closed]

I want to communicate with an old keyboard asynchronously through a single open collector, bidirectional data pin. As part of the protocol, the timing will be controlled entirely by pulse width. I've ...
1
vote
1answer
185 views

Arduino Nano /Uno USB is not getting recognized

I have multiple Unos and Nano and recently due to some bad configuration the USBs are not getting recognised on my Mac Air Laptop. These were working models for almost 1-2 years. I used it to control ...
-1
votes
1answer
3k views

Send SMS Arduino Uno + SIM900A shield

I am working on a module to send messages. I write the message on the serial monitor + phone number and I have to send the message to the line. Question: How to send messages through the SIM900A ...
2
votes
2answers
10k 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 ...
1
vote
1answer
3k 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
votes
1answer
435 views

MKR FOx 1200 doesn't upload Sketch

My Arduino MKR Fox 1200 doesn't upload any sketches. First it worked, but now it doesn't. It compiles the bare minimum sketch (empty loop and empty setup) but then uploads forever and after a long ...
0
votes
1answer
400 views

Arduino Uno - Multiple modules for HDMI switch device

I have an Arduino Uno device that uses the following modules: 16 PIN LED w/ Backlight RFID - RC522 (RFID Reader) HR911105A (LAN Module - HanRun) These three modules use every digital pin available ...
1
vote
0answers
152 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 ...
2
votes
2answers
10k views

Arduino Mega 2560 interrupt pins and port mapping with rotary encoder

I am trying to use port manipulation in interrupts to read a rotary encoder. I found code for a Uno, so the port call for pins 2 and 3 are different. I think on the Mega they are PORTH3 and PORTH4 ...
0
votes
1answer
7k views

Using all ten capacitive touch inputs on the ESP32

I am using a Wemos Pro ESP32 development board and would like to be able to use all ten of the available capacitive touch inputs. I am able to get readings from nine of them but not T1. Here is the ...
2
votes
2answers
11k views

Problems with I2C connection on ESP8266 - 12F, which pins should I use?

Previously I had pined the temp/hum sensor HDC1080 with an Arduino using this sketch and everything worked fine. Now I want to run it over an ESP-12F, I uploaded it but it has issues at the time of ...
1
vote
1answer
1k 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 "\\.\...
1
vote
1answer
579 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 ...
0
votes
1answer
179 views

Arduino IDE compiling for non-arduino AVR boards

Using: Arduino IDE 1.8.2 the board manager from https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json an ATmega168P MCU in TQFP I was able to run my code successfully by modifying ...
0
votes
2answers
935 views

Where is PORTB defined?

On Arduino I can set digital pins by setting special variables PORTB and PORTD (or maybe they are not variables?). Where are those variables defined? I grepped /usr/share/arduino, but found nothing. ...
1
vote
2answers
108 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 ...
3
votes
2answers
7k views

Equivalent for PORTB in Arduino Mega 2560

Like I said in the subject, I would like to know the equivalent for the instruction: PORTB |= 0x01; PORTB &= ~0x01; More precisely I was using it to trigger a fast pulse conversion on my shield-...
1
vote
1answer
742 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++){ ...
2
votes
1answer
2k views

while(1) loop blocks program to enter interrupt

I want to build a program in C that enables / disables a passive matrix display. But my problem occurs before I can even implement one function of this display. I have a simple switch connected to ...
2
votes
1answer
407 views

Port Manipulation and serial communication

i'm working on a laser timer using arduino and i saw that using direct port manipulation can have a really better time precision. My only concern is about serial communication, because i am using some ...
1
vote
2answers
528 views

How fast can I read Arduino port D?

I'm trying to see how fast I can read an Arduino IO port. It's being toggled with an random speed /white square wave and I want to see which is faster, the Arduino or the signal. The pin on port D ...