Very new at this and ask myself the following question. When connecting a DS1307 to an Arduino Uno I connect two main wires to the Arduino A4 (SDA), A5 (SCL) pins. Yet is this not DIGITAL data going into the Arduino? Is pin A4 and pin A5 not ANALOG?
Thanks
All is explain in the datasheet of ATMEGA328p.
Les info sur le site arduino sont incompletes, il faut aller sur celui d'Atmel (le fabricant du micro).
Pierre7:
Very new at this and ask myself the following question. When connecting a DS1307 to an Arduino Uno I connect two main wires to the Arduino A4 (SDA), A5 (SCL) pins. Yet is this not DIGITAL data going into the Arduino? Is pin A4 and pin A5 not ANALOG?
Thanks
When the arduino wiring library software enables I2C internal hardware it disconnects pins A4 and A5 from the analog hardware and connects it to the I2C hardware. It is digital.
Pins A0 to A5 (arduino name) or PC0 to PC5 (Atmel name) can be connected to :
- digital I/O on PORTC --> they act as standard digital I/O.
- analog multiplexer (-> there is only ONE hardware ADC)
- I2C HARDWARE.
By default they are connected to PORTC and act as digital IO.
When ADC is enabled they are individually connected to ADC multiplexer inputs
When I2C (TWI) is enabled PC4 and PC5 (A4 and A5 arduino name) are connected to I2C internal hardware.
Have a look on the datasheet you will find more informations.
synoptique_general_ATMega328 (61.9 KB)
Thanks for the clarification. The ports are bilingual then ![]()
Official names are those of datasheet --> Atmel name.
They are renowned by arduino in pin_arduino.h file
You are not forced to use the arduino language to program an AVR Atmel
68tjs:
Official names are those of datasheet --> Atmel name.
They are renowned by arduino in pin_arduino.h file
You are not forced to use the arduino language to program an AVR Atmel
What other language ? Is it better?
Thanks
The Arduino language is easy to begin.
There are many libraries to use easily many components.
You're not forced to read and re-read many datasheets before using a component.
But, as it is intended to make programming easy, it is not optimized. Program runs slower and take more space than with direct programming registers in "C".
Set an IO in output with "pinMode(2, OUTPUT);" use 90 more bytes than write "DDRD |= (1<<PD2);" .
Toggle an IO with digitalWrite() takes 8 times more than with register.
Another example analogWrite () give you access only at the "FAST PWM" and only in 8bits mode because it is the common mode of different timers. However, some timer can make "Phase correct PWM" and/or the "phase and frequency correct PWM" with 8, 9, 10 or 16 bits.
But this direct register programming is difficult.
For beginning I think arduino language is good.
I think that the programming of registers is to be reserved to specific uses. But the important is not to use it absolutely, it is to know that it exist.
I think you speak french: "Dans la vie on ne peut pas gagner sur tous les tableaux."
NB : if you want there is an active "francophone" part in this forum.
68tjs:
The Arduino language is easy to begin.
There are many libraries to use easily many components.
You're not forced to read and re-read many datasheets before using a component.But, as it is intended to make programming easy, it is not optimized. Program runs slower and take more space than with direct programming registers in "C".
Set an IO in output with "pinMode(2, OUTPUT);" use 90 more bytes than write "DDRD |= (1<<PD2);" .
Toggle an IO with digitalWrite() takes 8 times more than with register.
Another example analogWrite () give you access only at the "FAST PWM" and only in 8bits mode because it is the common mode of different timers. However, some timer can make "Phase correct PWM" and/or the "phase and frequency correct PWM" with 8, 9, 10 or 16 bits.But this direct register programming is difficult.
For beginning I think arduino language is good.
I think that the programming of registers is to be reserved to specific uses. But the important is not to use it absolutely, it is to know that it exist.I think you speak french: "Dans la vie on ne peut pas gagner sur tous les tableaux."
NB : if you want there is an active "francophone" part in this forum.
Thanks for the pointers ![]()