Home > Back-end >  AT89C51
AT89C51

Time:10-26

Smart car C language programming

CodePudding user response:

Well, I often use AT89S52, 8 k, good,,,

CodePudding user response:

C51 with much more mature,

CodePudding user response:

Are generally use of C51,

CodePudding user response:

refer to the original poster mei1191767712 response:
do the C language programming of intelligent car


What's the problem??

CodePudding user response:

reference 4 floor xjq2003 response:
refer to the original poster mei1191767712 response: do the C language programming of intelligent car

What's the problem??


Scattered points,,,

CodePudding user response:

89 s52 using much more

CodePudding user response:

51 and 52 basically not much difference, it is more than a timer and ROM greaten, ha ha ha......

CodePudding user response:

Use S52 is more, most still STC89C52RC...

CodePudding user response:

I thought into the wrong BBS, VC and MCU

CodePudding user response:

You want to attend electronic design contest, if used for 51 single-chip microcomputer and industrial or Freescale and Fujitsu for
The example of 51 online.
Intelligent handling car hope to hope to get automatically grab the goods, tracking, automatic unloading goods,
Keil2 version:
#include
Unsigned char zkb1=0;//the left motor duty ratio, maximum 100
Unsigned char zkb2=0;//on the right side of the duty ratio of the motor, the maximum 100
Unsigned char t, t1=0;/counter/timer interrupt
Char jd1=2, jd2=4, jd3=3;//steering Angle control
Unsigned char ftaiqi=0, fjiaqu=0;//have the fetch, lift the clip?
Sbit RSIGN1=P2 ^ 0;//the left signal 1
Sbit RSIGN2=P2 ^ 1;//the left signal 2
Sbit LSIGN1=P2 ^ 2;//right signal 1
Sbit LSIGN2=P2 ^ 3;//right signal 2
Sbit IN1=P0 ^ 0;
Sbit IN2=P0 ^ 1;
Sbit IN3=P0 ^ 2;
Sbit IN4=P0 ^ 3;
Sbit PWM1=P0 ^ 4;//left dc gear motor
Sbit PWM2=P0 ^ 5;//right dc gear motor,
Sbit duoji1=P1 ^ 5;//left steering gear
Sbit duoji2=P1 ^ 6;//right steering gear
Sbit duoji3=P1 ^ 7;//steering gear up and down

Void xunji ();

Void delay (int) z////1 ms delay function
{
Int j, k;
For (j=z; J> 0; J -)
For (k=125; K> 0; K -);
}
//initialize the timer, interrupt
Void time_init ()//o. 1 ms and 0.5 ms
{
TMOD=0 x11;
TH0=(65536-7100)/256;
TL0=(65536-7100) % 256;
TH1=(65536-500)/256;
TL1=(65536-500) % 256;
EA=1;
ET0=1;
ET1=1;
TR0=1;
TR1=1;
}

Void timer0 () interrupt 1
{
TH0=(65536-7100)/256;
TL0=(65536-7100) % 256;
If (tPWM1=1;
The else
PWM1=0;
If (tPWM2=1;
The else
PWM2=0;
t++;
If (t>
=100)T=0;
}

Void timer1 interrupt ()
3{
TH1=(65536-500)/256;
TL1=(65536-500) % 256;
If (t1 & lt; Jd1)
Duoji1=1;
The else
Duoji1=0;
If (t1 & lt; Jd2)
Duoji2=1;
The else
Duoji2=0;

If (t1 & lt; Jd3)
Duoji3=1;
The else
Duoji3=0;
T1 + +;
If (t1==40)
T1=0;
}
Void qianjinfangxiang direction ()//
{
IN1=1;
IN2=0;
IN3=1;
IN4=0;
}

Void houtuifangxiang ()//backward direction
{
IN1=0;
IN2=1;
IN3=0;
IN4=1;
}

Void qianjin ()//straight
{
Zkb1=40;
Zkb2=40;
}

Void turn_left1 ()//small left function
{
Zkb1=10;
Zkb2=40;
}

Void turn_left2 ()//big left function
{
Zkb1=0;
Zkb2=50;
}

Void turn_right1 turn right ()//small function
{
Zkb1=40;
Zkb2=10;
}

Void turn_right2 turn right ()//big function
{
Zkb1=50;
Zkb2=0;
}


Void jiaqu ()//picking up goods
{
Fjiaqu=1;
Jd1=4;
Jd2=2;
Delay (400);
}

Void songkai ()//release the goods
{
Jd1=2;
Jd2=4;
Delay (400);
Fjiaqu=0;
}

Void taiqi ()//lift goods
{
Ftaiqi=1;
Jd3=5;
Delay (400);
}

Void fangxia ()//put down the goods
{
Jd3=3;
delay(500);
Ftaiqi=0;
}

Void the stop ()
{
Zkb1=0;
Zkb2=0;
}

Void houtui ()//back
{
Int I;
Houtuifangxiang ();
Zkb1=30;
Zkb2=30;
For (I=500; I> 0; I -)
{
Xunji ();
Delay (10);
}
}

Void diaotou ()//switching function
{
Char f1=0, f2=0, f3=0, f4=0;//sign
IN1=1;/////////////
IN2=0;/////////////
IN3=0;/////////////
IN4=1;/////////////

Zkb1=30;/////////////
Zkb2=30;
while(! (f1 & amp; & F2 & amp; & F3 & amp; & F4))
{
If (RSIGN1==1) f1=1;
If (RSIGN2==1) f2=1;
If (LSIGN1==1) f3=1;
If (LSIGN2==1) f4=1;
}
Delay (2000);///////////////////

Qianjinfangxiang ();
Qianjin ();

}


Void xunji ()//tracking function
{
If ((RSIGN1==0) & amp; & (RSIGN2==0) & amp; & (LSIGN1==0) & amp; & (LSIGN2==0))//straight
Qianjin ();
Else if ((RSIGN1==1) & amp; & (RSIGN2==0) & amp; & (LSIGN1==0) & amp; & (LSIGN2==0))//1, left turn right 1
Turn_right1 ();
Else if ((RSIGN1==1) & amp; & (RSIGN2==1) & amp; & (LSIGN1==0) & amp; & (LSIGN2==0))//2 left, turn right 2
Turn_right2 ();
Else if ((RSIGN1==0) & amp; & (RSIGN2==0) & amp; & (LSIGN1==0) & amp; & (LSIGN2==1))//starboard 1, left 1
Turn_left1 ();
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull