Go Down

Topic: Port manipulation on arduino mega 2560 (Read 170 times) previous topic - next topic

FernandoGarcia

Hi!

I want use the library "jeelib.h" to control a RFM12B.

I'm using the pin 69 (A15) as SS and need change the library to set this pin.

I found that should be "K" instead "B" on this part but,  I'm not sure.

https://github.com/jcw/jeelib/blob/master/RF12.cpp#L35

Code: [Select]

#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)


#define SS_DDR      DDRB
#define SS_PORT     PORTB
#define SS_BIT      0


I don't know if "SS_BIT" should be zero.

Please someone can help me?

Thanks in advance.

Fernando Garcia
Conheça uma nova opção Open Source para controlar seu aquário: www.ferduino.com

Jonathanese

Actually, pin A15 on the MEGA 2560 is PORTK bit 7.

This may come in handy:  https://spreadsheets.google.com/pub?key=rtHw_R6eVL140KS9_G8GPkA&gid=0


However, I wouldn't necessarily define it this way. Perhaps B10000000, 0x80, or 128 might be preferred, because it's already in the same boolean form that PORTK will be in. In one case I used a bit shift operator 1 << BIT so that setting BIT to 7 would shift 1 over 7 places.

FernandoGarcia

Hi!

Understood.

Thank you very much!

Best regards.

Fernando Garcia
Conheça uma nova opção Open Source para controlar seu aquário: www.ferduino.com

Go Up