3 软件部分
控制模块 U( STC12LE5201AD)由单片机完成,具有稳压作用, 同时写有程序。对整机进行控制。其中程序如下:
- - - - - ADDRESS- - - - - - -
WXY1 : JNB P3. 7, W XY2
MOV CCAP0L, DA_LOW
MOV CCAP0H, DA _H IGH
RET I
WXY2 : MOV CCAP0L, # 00H
MOV CCAP0H, # 00H
WXY3 : RET I
OUT _1 : SETB OUT _LED
SETB OUT _FMQ
MOV DA _H IGH, # 150
MOV DA _LOW, # 200
RET
CLR C : MOV A, # 255
SUBB A, IN2_AD_VALUE
MOV A, IN2_AD_VALUE
CJNE A, # 0AAH, OUT _14
OUT _14: JNC OUT _12
ADD a, # 2AH
CJNE A, # 0AAH, OUT _11
OUT _11: JC OUT _15
MOV A, # 0A2H
MOV DA _H IGH, A
MOV DA _LOW, # 21H
RET
OUT _12: MOV DA _H IGH, A
MOV DA _LOW, # 0AAH
OUT _13: RET
OUT _15: CJNE A, # 128, OUT _16
OUT _16: JNC OUT _12
ADD A, # 128
SJM P OUT _12
OUT _2: CLR OUT _LED
CLR OUT _FMQ: MOV DA _H IGH, # 150
MOV DA _LOW, # 200
OUT _21: RET
OUT _3 : CLR OUT _LED
CLR OUT _FMQ: MOV DA _LOW, # 15
MOV DA _H IGH, # 0
MOV DA _H IGH, # 150
MOV DA _LOW, # 200
RET
OUT _141: INC LED _T MI E
MOV A, LED_T IME
C JNE A, # 2, OUT _11
OUT _11: JNC OUT _12
SETB OUT _LED
SETB OUT _FMQ
SJM P OUT _13
OUT _12: CJNE A, # 6, OUT _14
OUT _14: JNC OUT _15
CLR OUT _LED
CLR OUT _FMQ
SJM P OUT _13
OUT _15: MOV LED_T IME, # 0
OUT _13: SETB OUT _FMQ
CLR NO _X INHAO
MOV NO_T MIE, # 0
CLR C
MOV A, # 255
SUBB A, IN2_AD _VALUE
C JNE A, # 0AAH, OUT _110
OUT _110: JC OUT _111
MOV A, # 099H
SJM P OUT _112
OUT _111: CJNE A, # 45, OUT _113
OUT _113: JNC OUT _112
MOV A, # 45
OUT _112: MOV DA _H IGH, A
MOV DA _LOW, # 0AAH
RET
OUT _2 : JB NO _X INHAO, OUT _231
INC NO_T MIE
MOV A, NO _T MI E
C JNE A, # 40, OUT _232
OUT _232: JC OUT _21
SETB NO _XINHAO
MOV NO _T IME, # 0
OUT _231: MOV H IGH _BYTE, A
MOV A, H IGH _BYTE
JZ OUT _21
CLR C
MOV A, LOW _BYTE
SUBB A, # 170
JC OUT _21
MOV LOW _BYTE, # 220
MOV H IGH _BYTE, # 0
OUT _21: RET
OUT _3 : JB NO_X INHAO, OUT _31
INC NO _T MI E
MOV A, NO _T IME
C JNE A, # 40, OUT _32
OUT _32: JC OUT _33
SETB NO _X INHAO
MOV NO_T MIE, # 0
OUT _31: CLR OUT _LED
CLR OUT _FMQ: MOV DA_LOW, LOW _BYTE
MOV DA_H IGH, H IGH _BYTE
MOV A, LOW _BYTE
ADD A, # 22
MOV LOW _BYTE, A
MOV A, H IGH _BYTE
ADDC A, # 0
OUT _33: MOV A, # 255
IN2_AD : MOV DA _H IGH, # 0
MOV DA _LOW, # 15H
END
4 结束语
本电路所设计的电子自动驾驶系统实现的功能和现有汽车上的成品定速巡航相同。但由于采用了模拟技术, 使得整机的成本大大降低。中央控制由于采用了单片机控制, 使得整机工作更加可靠, 功耗更低, 对于将来市场普及具有重要作用。