11 years, 7 months ago.

What does 1<<2 means here ????LPC_GPIO2->FIOSET = 1 << 2;

if ( (timer0_m0_counter > 0) && (timer0_m0_counter <= BLINK_INTERVAL) ) { LPC_GPIO2->FIOSET = 4;1 << 2 }

And if you know how to use timer and some examples describing please cause we just wanna move two motors.

3 Answers

6 years, 4 months ago.

Do you know how

11 years, 7 months ago.

What are you trying to do here exactly?

But 1<<2 means that you start with a 1, so 00000000001 binary. Then you shift it two positions to the left: 0000000100 is then the result.

Nope, this is something about the port and the pins but i dont know what it means exactly and it is the example of timer.h

posted by Jesus Galindo 11 Apr 2013

Do you have a project with a different library from PWM, RTC GPIO ADC DCA. Cause we are out of time and are begginers on this so we dont know much and we want a simple project with a different librarie it doesnt matter if its just a blink or a motor or so.

posted by Jesus Galindo 11 Apr 2013

1<<2 means exactly that. Maybe it is also handy if you link to which timer.h you are talking about. If you meant to ask what that code does, it sets the third bit of the FIOSET register of GPIO2. You can search in the user manual what this register does. Writing a '1' to FIOSET makes the output of the corresponding pin high iirc, and LPC_GPIO2 is probably port 2, so my guess is it enables pin P2[2].

Regarding your second question, I have no idea what you want to do and why. If you just want to blink a LED with a timer you can use the mbed libraries and have no reason to go to the hardware. But if you go to the hardware you need for sure to google the user manual for your microcontroller.

posted by Erik - 11 Apr 2013
11 years, 7 months ago.

The same is true for 1<<3 ;)

Do you know how to use timer.h? It is the example of that

posted by Jesus Galindo 11 Apr 2013