Hi
I'm working on a project to drive a DC motor, I really didn't find any example. I would like to know how can I program a pin in Keil, and I would be happy to have a simple example about it.
By the way Im using NRF51 DK.
Bests,
Hi
I'm working on a project to drive a DC motor, I really didn't find any example. I would like to know how can I program a pin in Keil, and I would be happy to have a simple example about it.
By the way Im using NRF51 DK.
Bests,
Hey Guys Thank you for your helps but one remaining issue about blinky example is that, it use a pre-defined functions to configure leds pin.
I really need a simple example which goes directly to gpio.h and shows how to work with this library
Thank you for your comment. As an example if I want to describe for you,
enter code here
#ifndef F_CPU
#define F_CPU 8000000UL // 16MHz clock speed
#endif
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRC = 0xFF; //PORTB as Output
while(1)
{
//Rotates Motor in Antilockwise
PORTC = 0x01; //00000001
_delay_ms(4000);
//Stops Motor
PORTC = 0x00; //00000000
_delay_ms(4000);
//Rotates Motor in Clockwise
PORTC = 0x02; //00000010
_delay_ms(4000);
//Stops Motor
PORTC = 0x03; //00000011
_delay_ms(4000);
}
}
this is a simple example which gives me an idea how to control a port on microcontroller directly.My question is that whetehr such a simple senario is available?
Thank you for your comment. As an example if I want to describe for you,
enter code here
#ifndef F_CPU
#define F_CPU 8000000UL // 16MHz clock speed
#endif
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRC = 0xFF; //PORTB as Output
while(1)
{
//Rotates Motor in Antilockwise
PORTC = 0x01; //00000001
_delay_ms(4000);
//Stops Motor
PORTC = 0x00; //00000000
_delay_ms(4000);
//Rotates Motor in Clockwise
PORTC = 0x02; //00000010
_delay_ms(4000);
//Stops Motor
PORTC = 0x03; //00000011
_delay_ms(4000);
}
}
this is a simple example which gives me an idea how to control a port on microcontroller directly.My question is that whetehr such a simple senario is available?