Arduino Changes - PalouseRobosub/SUBLIBinal GitHub Wiki

#Arduino Differences Due to the inherent construction differences between the PIC32MX2xx1xx series and the AVR ATMega328P, there are a number of differences to be known. Please refer to the list below to see the list of differences


####ADC Changes The ADC changes include the following:

  • The ADC_Channel enumeration has been changed to
    typedef enum {
        ADC_CH_0,
        ADC_CH_1,
        ADC_CH_2,
        ADC_CH_3,
        ADC_CH_4,
        ADC_CH_5
    } ADC_Channel;

These are the only channels available on the ATMega328P.

top


####External Interrupt Changes External interrupts have been changed in the following ways:

  • Addition of pin change interrupts (an interrupt will be generated on the toggle of any enabled pin change pins). PCINT2 is triggered by a pin change on any of enabled PC[23:16], PCINT1 is triggered by a pin change on any of enabled PC[15:8], and PCINT0 is triggered by a pin change on any of enabled PC[7:0] regardless of the data direction of these pins.
  • Modification of the Interrupt enumeration to
    typedef enum {
        INT0,
        INT1,
        PCINT0,
        PCINT1,
        PCINT2
    }Interrupt;
  • Modification of the Polarity enumeration to
    typedef enum {
        falling,
        rising,
        toggle
    } Polarity;
  • Modification of the Resistor enumeration to
    typedef enum {
        none,
        pullup
    } Resistor;
  • Modification of the Interrupt_Config structure to
    typedef struct INTERRUPT_CONFIG{
        Interrupt extInt;
        char pins;
        Polarity polarity;
        int enable;
        Resistor resistor;
        void *callback;
    } Interrupt_Config;

The pins parameter is a bitfield of all chosen PCINT pins to be enabled for the respective PCINT. To enable PCINT0 and PCINT3 pins for extInt = PCINT0, you would supply the value of (1<<0)|(1<<3). If you supplied the value (1<<0)|(1<<3) when extInt = PCINT1, PCINT8 and PCINT11 pins would be enabled to trigger PCINT1.

Please note: When working with pin change interrupts, polarity and resistor values are not used!

top


####I2C Changes

top


####UART Changes

top


####Timer Changes

top


####SPI Changes

top


####PWM Changes

top