Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

tuto: how to use Arduino-Uno with the same Pin name

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO
View previous topic :: View next topic  
Author Message
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1162
Location: France

france.gif
PostPosted: Sun May 15, 2016 3:00 pm    Post subject: tuto: how to use Arduino-Uno with the same Pin name Reply with quote

Mark suggested me this little tutorial that allows with a very simple file "Arduino-uno - pin.inc" to use the names proposed by Arduino.
I believe that Ben Zijlstra had already made one but I did not found it. (I'm confuse Ben Embarassed )
This allows to better translate the examples and programs written in C-arduino.

Here the inc file, in the added files 2 samples (ledon/ledoof and the Ds3231 clock using I2C pin)


'------Mark Alberts and J.Pierre Duval 15-05-2016 -----------------------------------
' include file if you want to be close of arduino'pin name

' Remark of Evert : to put the pin in input you have to change PORTX.y in PINX.y
'**************************Arduino names*********************************************
'--------digital-------------------
PIN0 alias portd.0 'take care it is also Rx0
PIN1 alias portd.1 'take care it is also Tx0
PIN2 alias PORTD.2 'int0
PIN3 alias PORTD.3 'int1
PIN4 alias PORTD.4
PIN5 alias PORTD.5
PIN6 alias PORTD.6
PIN7 alias PORTD.7

PIN8 alias PORTB.0
PIN9 alias PORTB.1
PIN10 alias PORTB.2 'SS -----timer1 PWM------- 'this 4 pins are hardware Bus SPI
PIN11 alias PORTB.3 'mosi ---------------------- 'SS (select ship could be another pin)
PIN12 alias PORTB.4 'miso ----------------------
PIN13 alias PORTB.5 'sck----------led arduino---

'--------analogic-------------------
A0 alias PORTC.0
A1 alias PORTC.1
A2 alias PORTC.2
A3 alias PORTC.3
A4 alias PORTC.4
A5 alias PORTC.5
'--------bus I2C------------------- 'with bascom you can use other pins
A_SDA alias PortC.4
A_SCL alias PortC.5
'----------------------------------------------------------------------------------------------------
JP
Wink


Last edited by Duval JP on Mon May 16, 2016 11:46 am; edited 1 time in total
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5915
Location: Holland

blank.gif
PostPosted: Sun May 15, 2016 8:54 pm    Post subject: Reply with quote

Thank you Jean-Pierre,

I think this will make things easier.

_________________
Mark
Back to top
View user's profile Visit poster's website
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Sun May 15, 2016 10:21 pm    Post subject: Reply with quote

And what if the the arduino PINx is used as input, you need to change the PORTD.x to PIND.x ?
_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5915
Location: Holland

blank.gif
PostPosted: Sun May 15, 2016 10:45 pm    Post subject: Reply with quote

that is an option.
another option is to add an alias.
I guess the users of this file can inform us about it?

_________________
Mark
Back to top
View user's profile Visit poster's website
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1162
Location: France

france.gif
PostPosted: Mon May 16, 2016 11:44 am    Post subject: Reply with quote

Yes Evert you are right, but in this case it is easy to change the .inc file

Thank you for the remark. I change a line in the post
JP
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum