12:01 pm
March 19, 2015
Hello,
ist it possible to write the ports "K" or "F" on Arduino Mega (using analog ports for digital output)?
here is an example of source code:
void setup() {
for (int i= 1; i<100; i++)
{
pinMode(i, OUTPUT);
}
DDRF = B00000000;
}
void loop() {
PORTF = B11111111;
delay(1000); // wait for a second
PORTF= B00000000;
delay(1000); // wait for a second
}
Greetings, Vitali
8:18 pm
March 12, 2015
You should be able to using Digital Write Port.vi. Take a look at the documentation. You only need to specify the start pin and the all bits in the corresponding port will be updated with the given value. Make sure to set all pins as an output first. You can also refer here for the mapping of pins to ports on the Mega. I think you are interested in pins 82-97.
2:19 pm
March 12, 2015
Take a look at digital_pin_to_port_PGM[] in \Arduino\hardware\arduino\avr\variants\mega\pins_arduino.h. This defines the mapping of pin number to physical port for the Mega. It appears Port F starts at pin 54 and Port K starts at pin 62. You actually want to use the Mapped Pin Name in the link above in which the digital version of the analog pins start their numbering after the last digital pin in the list (53) but its not explicitly listed there so you have to go to the header file.
5:47 am
December 25, 2017
Hi...i am a new user here. As per my knowledge you should specify the start pin and the all bits in the corresponding port will be updated with the given value. Make sure to set all pins as an output first. You can also refer manual for the mapping of pins to ports on the Mega.
21
1 Guest(s)