Swierzy Marek

Pin Toggeling MCF5485

Discussion created by Swierzy Marek on Jan 28, 2007
Latest reply on Mar 12, 2007 by Paolo Colombara
Hi Commuity,

i am new to the Coldfire and try to toggel a pin as fast as possible.
The pin toggeling wasn't faster then ~1 Mhz.
I use the Cobra5485 board(from sentec) and thought that the toggling speed should be much faster.

here the source i used to toggel the pins.
Is there no way to toggel the pins faster?
I use the gcc crosscompiler.




#define IPSBAR 0x10000000

#define PAR_PCS3 (IPSBAR + 0xA4C)
#define PAR_PCS2 (IPSBAR + 0xA4D)
#define PAR_PCS1 (IPSBAR + 0xA4E)
#define PDDR_PSC3PSC2 (IPSBAR + 0xA1C)
#define PDDR_PSC1PSC0 (IPSBAR + 0xA1D)
#define PODR_PSC3PSC2 (IPSBAR + 0xA0C)
#define PODR_PSC1PSC0 (IPSBAR + 0xA0D)
int main(void );

void __main(void)
{
main();
}

int main(void)
{
int iCount;
unsigned char ucPortMask;


// set Ports to digital I/O:
(*(unsigned char *)(PAR_PCS3)) = 0x00;
(*(unsigned char *)(PAR_PCS2)) = 0x00;
(*(unsigned char *)(PAR_PCS1)) = 0x00;

// set Ports as outputs:
(*(unsigned char *)(PDDR_PSC3PSC2)) = 0x3F;
(*(unsigned char *)(PDDR_PSC1PSC0)) = 0xC0;


// switch the leds off:
*(unsigned char *)(PODR_PSC3PSC2) = 0x3F;
*(unsigned char *)(PODR_PSC1PSC0) = 0xC0;

ucPortMask = 0x01;
iCount=0;
*(unsigned char *)(PODR_PSC3PSC2) = 0x3F;
while(1)
{



if(iCount==1)
{
*(unsigned char *)(PODR_PSC1PSC0) = (unsigned char)0x01;
iCount=0;
}
else
{*
(unsigned char *)(PODR_PSC1PSC0) = (unsigned char)0xC0;
iCount=1;
}

}

return(0);
}



kind regards

marek

Outcomes