אני רשמתי תוכנה בשפת C לבקר מנוע :
https://www.4project.co.il/product/507
ומשום מה לא עובד לי.
אפשר לבדוק אולי איפשהו טעיתי.
קוד: בחירת הכל
#include "REG_89C51.h"
#include "type_var_H.h"
#include "lcd_play.h"
void delay_lcd();
void delay();
void forward()
{
u8 data STB,i;
P0_6 = STB; // P0_6 connected to stb pin
STB='1'; // For work, pin stb need to be '1'
while(1)
{
for(i=0 ; i<9000000 ; i++)
{
P0_4='1';// PWM A get '1' to work full speed
P0_5='1';// PWM B get '1' to work full speed
P0_0='0';//Motor A
P0_1='1';//Motor A
P0_2='1';//Motor B
P0_3='0';//Motor B
}
for(i=0 ; i<1000000 ; i++)
{
P0_4='0';// PWM A get '0' to delay
P0_5='0';// PWM B get '0' to delay
}
}//End if(n=='2')
}//End void forward()
//===================================================================
void reverse()
{
u8 data STB,i;
P0_6 = STB; // P0_6 connected to stb pin
STB='1'; // For work pin stb need to be '1'
while(1)
{
for(i=0 ; i<9000000 ; i++)
{
P0_4='1';// PWM A get '1' to work full speed
P0_5='1';// PWM B get '1' to work full speed
P0_0='1';//Motor A
P0_1='0';//Motor A
P0_2='0';//Motor B
P0_3='1';//Motor B
}
for(i=0 ; i<1000000 ; i++)
{
P0_4='0';// PWM A get '0' to delay
P0_5='0';// PWM B get '0' to delay
}
}//End if(n=='8')
}//End void reverse()
//===================================================================
void right()
{
u8 data n = write_num();
u8 data STB,i;
P0_6=STB; // P0_6 connected to stb pin
STB='1'; // For work pin stb need to be '1'
while(1)
{
for(i=0 ; i<9000000 ; i++)
{
P0_4='1';// PWM A get '1' to work full speed
P0_5='1';// PWM B get '1' to work full speed
P0_0='0';//Motor A
P0_1='0';//Motor A
P0_2='1';//Motor B
P0_3='0';//Motor B
}
for(i=0 ; i<1000000 ; i++)
{
P0_4='0';// PWM A get '0' to delay
P0_5='0';// PWM B get '0' to delay
}
}//End if(n=='6')
}//End void right()
//===================================================================
void left()
{
u8 data n = write_num();
u8 data STB,i;
P0_6=STB; // P0_6 connected to stb pin
STB='1'; // For work pin stb need to be '1'
while(1)
{
for(i=0 ; i<9000000 ; i++)
{
P0_4='1';// PWM A get '1' to work full speed
P0_5='1';// PWM B get '1' to work full speed
P0_0='0';//Motor A
P0_1='1';//Motor A
P0_2='0';//Motor B
P0_3='0';//Motor B
}
for(i=0 ; i<1000000 ; i++)
{
P0_4='0';// PWM A get '0' to delay
P0_5='0';// PWM B get '0' to delay
}
}//End if(n=='4')
}//End void left()
//===================================================================
void riht_point()
{
u8 data n = write_num();
u8 data STB,i;
P0_6=STB; // P0_6 connected to stb pin
STB='1'; // For work pin stb need to be '1'
while(1)
{
for(i=0 ; i<9000000 ; i++)
{
P0_4='1';// PWM A get '1' to work full speed
P0_5='1';// PWM B get '1' to work full speed
P0_0='1';//Motor A
P0_1='0';//Motor A
P0_2='1';//Motor B
P0_3='0';//Motor B
}
for(i=0 ; i<1000000 ; i++)
{
P0_4='0';// PWM A get '0' to delay
P0_5='0';// PWM B get '0' to delay
}
}//End if(n=='9')
}//End void riht_point()
//===================================================================
void left_point()
{
u8 data n = write_num();
u8 data STB,i;
P0_6=STB; // P0_6 connected to stb pin
STB='1'; // For work pin stb need to be '1'
while(1)
{
for(i=0 ; i<9000000 ; i++)
{
P0_4='1';// PWM A get '1' to work full speed
P0_5='1';// PWM B get '1' to work full speed
P0_0='0';//Motor A
P0_1='1';//Motor A
P0_2='0';//Motor B
P0_3='1';//Motor B
}
for(i=0 ; i<1000000 ; i++)
{
P0_4='0';// PWM A get '0' to delay
P0_5='0';// PWM B get '0' to delay
}
}//End if(n=='7')
}//End void left_point()
//===================================================================
void stop()
{
u8 data STB,i;
P0_6=STB; // P0_6 connected to stb pin
STB='1'; // For work pin stb need to be '1'
while(1)
{
for(i=0 ; i<9000000 ; i++)
{
P0_4='1';// PWM A get '1' to work full speed
P0_5='1';// PWM B get '1' to work full speed
P0_0='0';//Motor A
P0_1='0';//Motor A
P0_2='0';//Motor B
P0_3='0';//Motor B
}
for(i=0 ; i<1000000 ; i++)
{
P0_4='0';// PWM A get '0' to delay
P0_5='0';// PWM B get '0' to delay
}
}
}//End void stop()
//===================================================================
void standby()
{
u8 data STB,i;
P0_6=STB; // P0_6 connected to stb pin
STB='0'; // For work pin stb need to be '0'
while(1)
{
for(i=0 ; i<9000000 ; i++)
{
P0_4='1';// PWM A get '1' to work full speed
P0_5='1';// PWM B get '1' to work full speed
P0_0='0';//Motor A
P0_1='0';//Motor A
P0_2='0';//Motor B
P0_3='0';//Motor B
}
for(i=0 ; i<1000000 ; i++)
{
P0_4='0';// PWM A get '0' to delay
P0_5='0';// PWM B get '0' to delay
}
}
}//End void standby()