;********************************************************************************* ; gpspeed-template GpSpeed template for creating test and running code ; Terry@RotaryRacer ;********************************************************************************* ; ; This is a basic template to create programs for the GpSpeed controller. ; ; For: PICAXE-28X2 (PIC18F25K22) ; ; GpSpeed pins are: ; B.1 LED ; C.2 Motor PWM ; C.1 Fan PWM ; A.0 Analogue Input 0, I0, throttle ; A.1 Analogue Input 1, I1, misc ; A.2 Analogue Input 2, Voltage measurement ; A.3 Analogue Input 3, Current measurement (Hall effect) ; B.4 Analogue/Digital Input, I2 ; ; B.2 Analogue Input 8, Current measurement (Mosfet) ; B.0 Error, error from Motor PWM ; C.3 I2C Clk ; C.4 I2c Dat ; C.0 User 0, I2c Int ; B.3 User 1 ; C.6 SER1 TX ; C.7 SER1 RX ; ; Symbols for pin names and variables symbol pinLed = B.1 ; The LED pin symbol pinPwmMotor = C.2 ; The motors PWM pin init: let adcsetup = %000000000001111 ; Initialises ADC inputs pwmout pinPwmMotor, 49, 0 ; Initialises Motor PWM hardware to 20khz. PWM range is 0-199 mainLoop: high pinLed ; Turns LED on pause 500 ; Delays for 500ms low pinLed ; Turns LED off pause 500 ; Delays for 500ms goto mainLoop