标题: 请帮忙看看这个PIC单片机程序,编译通过,但是仿真和实际电路都不运行 [打印本页]

作者: supercaby    时间: 2017-8-23 10:24
标题: 请帮忙看看这个PIC单片机程序,编译通过,但是仿真和实际电路都不运行
这是一个电调程序,按照说明编译通过了,但就是不能用,请大神帮我编译一下看看,到底啥问题。谢谢!!!用proteus仿真报错:
实际电路中,上电后没有任何反应。
原理图如下:

程序在这里:
程序.rar (19.49 KB, 下载次数: 5)


英文的说明如下:
This project documents how to build and construct your own Brushed Motor ESC for Cars and Boats using a Microchip 12F675 PIC and a small number of standard components.
This ESC is an extension of an earlier aircraft ESC and the reader is referred to the earlier ESC for full details of the design.
Background
This ESC grew out of an earlier aircraft ESC. A number of people asked for an ESC with brake and reverse operations that were suited to Car and Boat operations. While the earlier design provided basic reverse facilities I decided not to extend the aircraft design, but rather to revise the design and produce a project targeted specifically at cars and boats.
This ESC operates in a very similar manner to the Team Tekin "Rebel 2" ESC and offers all of the key features of the earlier aircraft ESC as well as push-button programming.
A futher requirement was the desire to be able to use either a relay or an H-bridge to provide motor reverse. This project incorporates both options.
What this ESC offers
This ESC design offers the following features that are fully explained in the aircraft ESC documentation:
In addition the following features are specific to this ESC:
Push-button configuration
This ESC has a push button and LED that permit the ESC to be configured. The configuration is stored in the EEPROM on the PIC and will stay set until reconfigured.
The configuration system permits the configuration of the throttle range, the brake to reverse delay, and also the disabling of the reverse function.
User's Manual
Important Note
On power up the ESC will not arm until the throttle is in the neutral position. It is possible to perform throttle configuration during this time using the configuration system (see below). The ESC also requires the throttle to be in the neutral position to rearm the ESC after:
Status LED (Relay version)
The status LED is ON whenever the brake is active, and off at other times. The status LED is also used during configuration (see below).
Status LED (H-bridge version)
The status LED is ON whenever the ESC is in reverse, and off at other times. The status LED is also used during configuration (see below).
Configuration of the ESC
Brake to Reverse Delay
To set the brake to reverse delay period press the 'program' switch and keep it pressed for the delay period required and the release the button. When the button is first pressed the LED will start to flash on and off rapidly. The maximum delay time that can be configured is approximately 5 seconds, after 5 seconds the LED will show a short on flash and a long off flash. If the button is released during this time the maximum 5 second delay is configured.
Disable Reverse
To disable reverse in the ESC press the 'program' button and keep it pressed. At first the LED will flash on and off rapidly. Then, after about 5 seconds the LED will change to a short on flash and a long off flash, keep pressing the burron. After another 5 seconds the LED will alter to a long on flash and long off flash, now release the button.
Configure throttle
To configure the throttle first ensure that the throttle is in the neutral position.
Press the 'program' button and hold it down. At first the LED will flash on and off rapidly. Then, after about 5 seconds the LED will change to a short on flash and a long off flash, keep holding the burron down. After another 5 seconds the LED will alter to a long on flash and long off flash, keep holding the button down.
After a further 5 seconds the LED will return to flashing on and off rapidly, release the 'program' button.
The LED will continue to flash on and off rapidly. Pull the throttle to the full forward direction and hold it there for a few seconds and then return the throttle to the neutral position.
The LED will change to flashing with a long on and long off, this indicates that the forward throttle settings have been configured. Push the throttle to the full brake/reverse position and hold it there for a few seconds and then return the throttle to the neutral position.
The LED will stop flashing and the ESC's throttle settings are now configured.
Software Development Environment
This software was developed with the MPLAB IDE from MicroChip.
If you plan to use this ESC design and build one yourself you will need to download the MPLAB IDE. There are too many ESC options for all the versions to be available on this Web page. With the earlier aircraft design I provided a few 'common' versions of the software, however, with this ESC I have assumed that anyone building the ESC will select the options and assemble the code for themselves.
After you have installed the MPLAB IDE proceed as follows:
The MPLAB IDE has full support for simulation that permits you to fully check the operation of the ESC. However, the use of these facilities is beyond the scope of this document. Users who just want to build a 'custom' version by modifying standard parameters of the ESC should have no problem just using the IDE to assemble the code.
The ESC Software
The PWM Engine Generator
This ESC uses a software PWM engine that is machine generated by a Perl program. The source code for this program is available as part of the earlier aircraft ESC. Please consult the other document for details.
Main ESC module
The main ESC module contains all of the ESC application, with the exception of the PWM engine file. This source file contains a number of constants at the top that you can modify so suit your application.
Linear PWM engine
A linear (ie. throttle position proportional to percentage duty cycle) PWM include file is available that implements the 'basic' ESC.
Power PWM engine
A power (ie. throttle position proportional to engine power) PWM include file is available.
ESC Software Options
This ESC has a number of options that you can configure prior to programming the PIC. These options include:
Prior to constucting this ESC you should review the documentation at the top of the caresc.asm source module and alter the configuration setting to produce the combination of options that you require.
Circuits
There are 2 circuits available that show the ESC in its intended configuration. One circuit uses a relay to provide the reverse functions and the other shows a sample H-bridge design.
Note: These circuits all show a single FET in each position in the curcuit. For large motor currents it will probably be the case that more FETs in parallel are required and appropriate heatsinks considered. The details of this are left to the reader.
A note about the H-bridge
The H-bridge citcuit is provided as a starting point only. It is a simple design using two P-channel FETs and two N-channel FETs. The P-channel FETS have a relativly high On resistance and in most circumstances the use of all N-channel FETs would be more appropriate. Replacing the P-channel FETs with N-channel FETs requires a more complex drive arrangement and this is not documented here.
Where is everything?
The files available for download are:

File NameDescription
caresc.asm
PIC 12F675 Assembler Source
linear.inc
PIC 12F675 Assembler Include File
power.inc
PIC 12F675 Assembler Include File
rcaresc.gif
Circuit diagram for relay reverse
hcaresc.gif
Circuit diagram for H-bridge reverse



Construction Details
There are no constuction details provided for this ESC. The example shown in the aircraft ESC can easily be adjusted for use with the relay reverse ESC. The H-bridge ESC would require a desgin that was primarily determined by the details of the H-bridge system.

原始页面地址:vmdsoft点designsoft点com点au/ahome/rc/PIC-CarESC/




作者: supercaby    时间: 2017-8-31 22:02
大神们啊,帮帮忙啊~




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1