2018-11-12 12:34 AM
Hello,
I am trying to access all the 5 gpio pins out of FIVE Gpio pins I am accessing 4 gpio pinss i.e (PD6/PA1 ,PA3,PC5,PC6).
------->Port d and port c are accessing normally but port b is not able to access.
------->As per data sheet if we use swim pin as gpio we should use 5 sec delay in the main function .but is not working.
#define PB_ODR *(unsigned char*)0x5005
#define PB_DDR *(unsigned char*)0x5007
#define PB_CR1 *(unsigned char*)0x5008
#define PB_IDR *(unsigned char*)0x5006
//#define WWDG_CR *(unsigned char*)0x50D1
unsigned long int dl;
int i;
void main()
{
for(dl = 0; dl < 500000; dl++);//delay for 5sec
PB_ODR = 0x00; // Turn all pins of port B to low
PB_DDR |= 1 << 4; // 0x00100000 PB4is now output
PB_CR1 |= 1 << 4; // 0x00100000 PB4 is now pushpull
while(1) {
(dl = 0; dl < 500000; dl++);
PB_ODR |= 1 << 4; //led on
for (dl = 0; dl < 500000; dl++);
PB_ODR &= ~(1 << 4); //led off
}
}
THIS IS NOT WORKING,PLEASE HELP ME.
THANKS IN ADVANCE.