Hi! In Hello example for 8051 by MCB900 in main() there is: P2M1=0; P1M1=0; Is it ok?? Im reading the datasheet of de microcontroller and i dont understand it, because to configurate the port is using PxM1 and PxM2. Then why is writed these (bold text)?? Thanks
Well, - The chip is P89LCP936. - And only i want to see how can i switch on/off the led P2. In hello example: Write Hello in serial port this is the configuration:
void main() { unsigned int j; P2M1 = 0; P1M1 = 0; SCON = 0x52; /* initialize UART */ BRGR0 = 0xF0; /* 9600 baud, 8 bit, no parity, 1 stop bit */ BRGR1 = 0x02; while (1) { for (j = 0x01; j <= 0x80; j <<= 1) { /* Blink LED 0,1,2,3,4,5,6 */ P2 = j; /* Toggle port 2 pins each time we print */ //printf ("Hello World\n"); /* Print "Hello World" */ printf ("Hello \n"); delay (); /* Delay about 0.2 seconds */ } } }
Why : P2M1 = 0; P1M1 = 0;?????
Thanks
Note that P2 is a PORT - not an LED.
"Why: P2M1 = 0; P1M1 = 0;?"
Why not?
As Per suggested, have you actually looked in the Datasheet to see what effect writing zero to these registers will have? That should answer your question...
So look at the examples about the LEDs, then!
Go to http://www.keil.com/download/list/c51.htm and see what LPC9xx examples are available...
View all questions in Keil forum