Closed leonclear closed 3 years ago
This sounds like a student assignment to me. Why don't you just try it and see if it works?
How to use the second (hardware-)UART (on Pins PD2/PD3) on ATmega128 ? show an example please.
You can use the hardware serial pins on pin PD2 and PD3. This is Hardware serial 1, and you use Serial1.begin();
.
show an example for use attachInterrupt(); attachInterrupt(0). for pin pe2 attachInterrupt(1). for pin pe3
Pin PE2 does not have interrupt capabilities. Neither does PE3. See pinout picture below.
will the libraries work...
Yes, but not on pin PF0 - PF7. See #102 for details
is it pwm pin : 12,13,14,15, 4, 5 ,53 ?
Pin 53 is not available on ATmega128. There are PWN capabilities on pin 3, 4, 5, 12, 13, 14 and 15.
will the function analogWrite(12); work correctly?
No, the ATmega128 only has 8 analog inputs.
will the function analogWrite(12); work correctly?
No, the ATmega128 only has 8 analog inputs. analogWrite is output (PWM), no?
My bad.
will the function analogWrite(12); work correctly?
Yes, this will work since pin 12 has PWM capabilities
Please , show an example for use attachInterrupt();
for some pin. Is function attachInterrupt(4);
for pin PE4 is correct?
Please , show an example for use attachInterrupt();
It isn't my job to demonstrate standard Arduino functionality. You can read about interrupts here: https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/
Is function attachInterrupt(4); for pin PE4 is correct?
Yes, that will work, but it is recommended to use attachInterrupt(digitalPinToInterrupt(4), interruptFunction, mode)
I have some code running on a Mega2560 pro board that I
wanted to port to a Mega128 using Megacore to further
integrate it in a HW design I have.
PD2/PD3) on ATmega128 ? show an example please.
how to access the port can i use the code?:
Serial2.begin(9600); int thisByte = 33; int secondByte = 37; Serial2.print(", dec: "); Serial2.println(thisByte+secondByte);
attachInterrupt(1). for pin pe3
https://www.arduinolibraries.info/libraries/one-wire https://www.arduinolibraries.info/libraries/dallas-temperature
to connect ds18b20.
is it pwm pin : 12,13,14,15, 4, 5 ,53 ?
will the function analogWrite(12); work correctly?
show an example for use analogWrite(12);