I am new to all things Freescale. I am trying to learn by starting with the most basic project. This is to flash a LED. This is my code.
#include "MPC5633M.h"
void Delay(void){
uint16_t x;
uint16_t y;
for(x=0;x<50;x++) {
for(y=0;y<1000;y++) {
}
}
}
int main(void) {
SIU.PCR[188].R = 0x0200; /* Enable pin for LED1 (EMIOS9) as output*/
/* Loop forever */
for (;;) {
Delay();
SIU.GPDO[2].R &= 0x07000000; /* Enable LED1*/
Delay();
SIU.GPDO[2].R |= 0x08000000; /* Disable LED1*/
}
}
It does not work. Good reasion for this is the magic numbers like 0x0200, 0x07000000, 0x08000000. I have no idea what these are, or how to set them correctly.
Ray.
解決済! 解決策の投稿を見る。
Hi Ray,
You may use just a following code to control single pin
SIU.GPDO[188].R = 0x1; /* set GPIO[188] */
SIU.GPDO[188].R = 0x0; /* clear GPIO[188] */
SIU.GPDO[188].R ^= 0x1; /* toggle GPIO[188] */
The SIU.PCR[188].R = 0x0200; sets the pin for GPIO function and enable output buffer, so you can control the pin by above codes.
BR,
Petr
Hi Ray,
You may use just a following code to control single pin
SIU.GPDO[188].R = 0x1; /* set GPIO[188] */
SIU.GPDO[188].R = 0x0; /* clear GPIO[188] */
SIU.GPDO[188].R ^= 0x1; /* toggle GPIO[188] */
The SIU.PCR[188].R = 0x0200; sets the pin for GPIO function and enable output buffer, so you can control the pin by above codes.
BR,
Petr