port define

Başlatan iguruz, 05 Ocak 2011, 00:28:18

iguruz

merhaba Chine malı bir geliştirme kiti var elimde
aşağıdaki gibi portları tanımlamış ama çözemedim
mesela PB5 ile PB14 aynı değeri alıyor neye göre atanıyor bu değer gibi
#define LED             ( 1 << 5 )              // PB5: LED D2

#define BP2             0x2000                     // PC13: BP2
#define BP3             0x0001                     // PA0 : BP3

#define UP              0x0800                     // PB11: UP
#define RIGHT           0x1000                     // PB12: RIGHT
#define LEFT            0x2000                     // PB13: LEFT
#define DOWN            0x4000                     // PB14: DOWN
#define OK              0x8000                     // PB15: OK

#define JOYSTICK        0xF800                     // JOYSTICK ALL KEYS
#define KEY_NONE        0xF800                     // JOYSTICK ALL KEYS

CLR

Alıntı yapılan: iguruz - 05 Ocak 2011, 00:28:18
merhaba Chine malı bir geliştirme kiti var elimde
aşağıdaki gibi portları tanımlamış ama çözemedim
mesela PB5 ile PB14 aynı değeri alıyor neye göre atanıyor bu değer gibi
#define LED             ( 1 << 5 )              // PB5: LED D2

#define BP2             0x2000                     // PC13: BP2
#define BP3             0x0001                     // PA0 : BP3

#define UP              0x0800                     // PB11: UP
#define RIGHT           0x1000                     // PB12: RIGHT
#define LEFT            0x2000                     // PB13: LEFT
#define DOWN            0x4000                     // PB14: DOWN
#define OK              0x8000                     // PB15: OK

#define JOYSTICK        0xF800                     // JOYSTICK ALL KEYS
#define KEY_NONE        0xF800                     // JOYSTICK ALL KEYS

Merhaba,

Sorun açık değil, PB5 ile PB14 aynı değeri almıyor, birini 0x8000 ile, diğerini 0x4000 ile maskeliyor, bu gayet mantıklı, 32bit işlemcilerde çıkışı set/reset yapmak ve data okumak için ayrı ayrı registerler kullanılır.
Knowledge and Experience are Power

iguruz