Код:
'============ПЕРЕМЕННЫЕ И ПОРТЫ================================================

Config Pinb.2 = Input       ' если 0 то идет зарядка

Config Pind.2 = Output : Portd.2 = 1 :
Config Pind.2 = Input : Tsop1 Alias Pind.2
Config Pind.3 = Input : Tsop2 Alias Pind.3

Config Pinb.0 = Output : Led_ir_back Alias Portb.0
Config Pinb.1 = Output : Led_ir_right Alias Portb.1
Config Pinb.2 = Output : Led_ir_left Alias Portb.3

Config Pinc.4 = Output : Led_r1 Alias Portc.4
Config Pinc.5 = Output : Led_g1 Alias Portc.5
Config Pinc.6 = Output : Led_r2 Alias Portc.6
Config Pinc.7 = Output : Led_g2 Alias Portc.7

Config Pind.6 = Output : All_ir_led Alias Portd.6
Config Pind.7 = Output : Portd.7 = 0 : Spik Alias Portd.7

Config Timer1 = Pwm , Pwm = 8 , Prescale = 1 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down
Config Pinc.2 = Output : Drl Alias Portc.2 : Config Pind.4 = Output
Config Pinc.3 = Output : Drr Alias Portc.3 : Config Pind.5 = Output



'============ ПОДПРОГРАММЫ===================================================

Declare Sub Влево(byval speed As Byte)
Declare Sub Вправо(byval speed As Byte)
Declare Sub Прямо(byval speed As Byte)
Declare Sub Назад(byval speed As Byte)
Declare Sub Стоп()

Declare Function Запрос_маяка(byval Adress As Byte , Byval Beacon_power As Byte) As Byte
Declare Function Binari_power(byval Dec_power As Byte) As Byte