I can control my rc car steering wheel left, center and right. But I can not make it move forward.
Im using the LPC2148 microcontroller.
Any help will be great!!!
================
this is my code:
=============
#include "pwm.h"
void pwm_init()
{
PINSEL0 &= ~(3<<14);
PINSEL0 |= (1<<15); // select P0.7 for PWM2
PINSEL1 &= ~(3<<10);
PINSEL1 |= (1<<10); // select P0.21 for PWM5
// new
PWMTCR = 0x02; // reset PWM
PWMMR0 = 0x00124F80; //set pwm period (20mS)
PWMPR = 0; // prescaler disabled
PWMPCR = 0x2400; // enable PWM2&5 output and chosen for single edge PWM
PWMTCR = 00001001; // counter and PWM enabled
PWMMR2 = 0x00; //0124F8; // set Match 2 to 0 ticks
//PWMMR5 = 0x00124F7F; // set Match 5 to 0 ticks
PWMMR5 = 0x00049F0;
PWMMCR = 0x0000003; // reset on Match 0
}
void left()
{
PWMMR2 = 0x00019A28;
PWMLER = 0x04;
}
void right()
{
rprintf("hola\n");
PWMMR2 = 0x000024F8;
PWMLER = 0x04;
}
void straight()
{
PWMMR2 = 0x000124F8;
PWMLER = 0x04;
}
void go()
{
PWMMR5 = 0x0001D4C0;
PWMLER = 0x20;
}
void stop()
{
PWMMR5 = 0x0000EA60;
PWMLER = 0x20;
}
void throttle()
{
PWMMR5 = 0x000F4240;
PWMLER = 0x20;
}
=================================
thanks =)