├── DSC02269-800x800.jpg ├── DSC02270-800x800.jpg ├── DSC02271-800x800.jpg ├── DSC02272-800x800.jpg ├── DSC02273-800x800.jpg ├── DSC02274-800x800.jpg ├── DSC02275-800x800.jpg ├── README.md ├── Screenshot from 2020-03-01 14-48-37.png └── src ├── Lebowski_2A1.zip └── Lebowski_2A1 ├── 30F_powerstart_v2pA1.X ├── ADC.s ├── LEDs.s ├── Makefile ├── PWM.s ├── angle_amplitude.s ├── backemf_phase_control.s ├── build │ └── default │ │ └── production │ │ ├── ADC.o │ │ ├── ADC.o.d │ │ ├── LEDs.o │ │ ├── LEDs.o.d │ │ ├── PWM.o │ │ ├── PWM.o.d │ │ ├── angle_amplitude.o │ │ ├── angle_amplitude.o.d │ │ ├── backemf_phase_control.o │ │ ├── backemf_phase_control.o.d │ │ ├── calc_wanted_ampli_imag.o │ │ ├── calc_wanted_ampli_imag.o.d │ │ ├── can_initialise.o │ │ ├── can_initialise.o.d │ │ ├── can_motor.o │ │ ├── can_motor.o.d │ │ ├── chip_status.o │ │ ├── chip_status.o.d │ │ ├── chip_update.o │ │ ├── chip_update.o.d │ │ ├── correct_drive_selection.o │ │ ├── correct_drive_selection.o.d │ │ ├── current_control.o │ │ ├── current_control.o.d │ │ ├── current_filtering.o │ │ ├── current_filtering.o.d │ │ ├── demod.o │ │ ├── demod.o.d │ │ ├── determine_update.o │ │ ├── determine_update.o.d │ │ ├── drive_0_all.o │ │ ├── drive_0_all.o.d │ │ ├── drive_1_all.o │ │ ├── drive_1_all.o.d │ │ ├── drive_2_hall.o │ │ ├── drive_2_hall.o.d │ │ ├── drive_2_sensorless.o │ │ ├── drive_2_sensorless.o.d │ │ ├── drive_2to3_hall.o │ │ ├── drive_2to3_hall.o.d │ │ ├── drive_2to3_sensorless.o │ │ ├── drive_2to3_sensorless.o.d │ │ ├── drive_3_all.o │ │ ├── drive_3_all.o.d │ │ ├── drive_3_hall_measure.o │ │ ├── drive_3_hall_measure.o.d │ │ ├── drive_3_measurement_functions.o │ │ ├── drive_3_measurement_functions.o.d │ │ ├── fill_pwm_and_sin_arrays.o │ │ ├── fill_pwm_and_sin_arrays.o.d │ │ ├── floating_point.o │ │ ├── floating_point.o.d │ │ ├── global_variables.o │ │ ├── global_variables.o.d │ │ ├── hallbased_phase_control.o │ │ ├── hallbased_phase_control.o.d │ │ ├── halls.o │ │ ├── halls.o.d │ │ ├── imp_collect_data.o │ │ ├── imp_collect_data.o.d │ │ ├── imp_collect_data_L.o │ │ ├── imp_collect_data_L.o.d │ │ ├── imp_collect_data_R.o │ │ ├── imp_collect_data_R.o.d │ │ ├── imp_process_data.o │ │ ├── imp_process_data.o.d │ │ ├── init_interrupts.o │ │ ├── init_interrupts.o.d │ │ ├── initialise.o │ │ ├── initialise.o.d │ │ ├── inverse_vbat.o │ │ ├── inverse_vbat.o.d │ │ ├── main_motor.o │ │ ├── main_motor.o.d │ │ ├── menu structure │ │ ├── calc_rom_variables.o │ │ ├── calc_rom_variables.o.d │ │ ├── convert_to_readable_L_and_R.o │ │ ├── convert_to_readable_L_and_R.o.d │ │ ├── current_sensor_offset_measurement.o │ │ ├── current_sensor_offset_measurement.o.d │ │ ├── main_menu.o │ │ ├── main_menu.o.d │ │ ├── menu_KvLR.o │ │ ├── menu_KvLR.o.d │ │ ├── menu_battery.o │ │ ├── menu_battery.o.d │ │ ├── menu_can.o │ │ ├── menu_can.o.d │ │ ├── menu_currents.o │ │ ├── menu_currents.o.d │ │ ├── menu_erpms.o │ │ ├── menu_erpms.o.d │ │ ├── menu_filters.o │ │ ├── menu_filters.o.d │ │ ├── menu_foc.o │ │ ├── menu_foc.o.d │ │ ├── menu_functions.o │ │ ├── menu_functions.o.d │ │ ├── menu_halls.o │ │ ├── menu_halls.o.d │ │ ├── menu_loop_coeffs.o │ │ ├── menu_loop_coeffs.o.d │ │ ├── menu_misc.o │ │ ├── menu_misc.o.d │ │ ├── menu_pwm.o │ │ ├── menu_pwm.o.d │ │ ├── menu_recov.o │ │ ├── menu_recov.o.d │ │ ├── menu_rom.o │ │ ├── menu_rom.o.d │ │ ├── menu_sensors.o │ │ ├── menu_sensors.o.d │ │ ├── menu_stored_status.o │ │ ├── menu_stored_status.o.d │ │ ├── menu_temp.o │ │ ├── menu_temp.o.d │ │ ├── menu_temp_functions.o │ │ ├── menu_temp_functions.o.d │ │ ├── menu_throttle.o │ │ ├── menu_throttle.o.d │ │ ├── menu_throttle_functions.o │ │ ├── menu_throttle_functions.o.d │ │ ├── mim_calculations.o │ │ ├── mim_calculations.o.d │ │ ├── motor_impedance_measurement.o │ │ ├── motor_impedance_measurement.o.d │ │ ├── report_checksum.o │ │ └── report_checksum.o.d │ │ ├── monitoring.o │ │ ├── monitoring.o.d │ │ ├── motor_sinus.o │ │ ├── motor_sinus.o.d │ │ ├── process_all_variables.o │ │ ├── process_all_variables.o.d │ │ ├── prog_mem.o │ │ ├── prog_mem.o.d │ │ ├── reset_vector.o │ │ ├── reset_vector.o.d │ │ ├── safety.o │ │ ├── safety.o.d │ │ ├── sine_i_imag.o │ │ ├── sine_i_imag.o.d │ │ ├── speed_control.o │ │ ├── speed_control.o.d │ │ ├── subrout_232.o │ │ ├── subrout_232.o.d │ │ ├── subrout_str.o │ │ ├── subrout_str.o.d │ │ ├── temp_macros.o │ │ ├── temp_macros.o.d │ │ ├── temp_routines.o │ │ ├── temp_routines.o.d │ │ ├── throttle_open.o │ │ ├── throttle_open.o.d │ │ ├── throttle_ramp.o │ │ ├── throttle_ramp.o.d │ │ ├── throttle_read.o │ │ ├── throttle_read.o.d │ │ ├── timers.o │ │ └── timers.o.d ├── calc_wanted_ampli_imag.s ├── calc_wanted_ampli_imag_fp.s ├── can_initialise.s ├── can_motor.s ├── check_phase_loop.s ├── check_phase_loop_fpversion.s ├── checksum ├── checksum 2818~ ├── checksum2815~ ├── checksum2816~ ├── checksum2817~ ├── checksum290_~ ├── checksum_han1~ ├── checksum~ ├── chip_memdump.s ├── chip_status.s ├── chip_update.s ├── correct_drive_selection.s ├── current_control.s ├── current_filtering.s ├── current_filtering.s~ ├── defines.inc ├── demod.s ├── determine_update.s ├── disect_current.s ├── dist │ └── default │ │ └── production │ │ ├── 30F_powerstart_v2pA1.X.production.cof │ │ ├── 30F_powerstart_v2pA1.X.production.hex │ │ ├── 30F_powerstart_v2pA1.X.production.map │ │ └── memoryfile.xml ├── drive_0_all.s ├── drive_1_all.s ├── drive_1_all_orig.s ├── drive_2_hall.s ├── drive_2_sensorless.s ├── drive_2to3_hall.s ├── drive_2to3_sensorless.s ├── drive_3_all.s ├── drive_3_hall_measure.s ├── drive_3_measurement_calculations.s ├── drive_3_measurement_functions.s ├── drive_functions.s ├── equations ├── fill_pwm_and_sin_arrays.s ├── filter_2nd_order.s ├── filter_4th_order.s ├── floating_point.s ├── fp_macros.mac ├── get_inductor_measurement_amplitude.s ├── global_variables.s ├── hallbased_phase_control.s ├── halls.s ├── imp_collect_data.s ├── imp_collect_data_IaW.s ├── imp_collect_data_L.s ├── imp_collect_data_R.s ├── imp_collect_data_v1.s ├── imp_process_data.s ├── imp_process_data_IaW.s ├── imp_process_data_v1.s ├── init_interrupts.s ├── initialise.s ├── inverse_vbat.s ├── macros.mac ├── main_motor.s ├── menu structure │ ├── calc_display_L_and_R.s~ │ ├── calc_rom_variables.s │ ├── convert_to_readable_L_and_R.s │ ├── current_sensor_gain_measurement.s │ ├── current_sensor_offset_measurement.s │ ├── draft menu structure │ ├── draft menu structure~ │ ├── main_menu.s │ ├── main_menu.s~ │ ├── menu_KvLR.s │ ├── menu_battery.s │ ├── menu_can.s │ ├── menu_currents.s │ ├── menu_erpms.s │ ├── menu_filters.s │ ├── menu_filters.s~ │ ├── menu_foc.s │ ├── menu_functions.s │ ├── menu_halls.s │ ├── menu_hftone.s~ │ ├── menu_loop_coeffs.s │ ├── menu_loop_coeffs.s~ │ ├── menu_misc.s │ ├── menu_misc.s~ │ ├── menu_pwm.s │ ├── menu_recov.s │ ├── menu_recov.s~ │ ├── menu_rom.s │ ├── menu_rom.s~ │ ├── menu_sensors.s │ ├── menu_stored_status.s │ ├── menu_stored_status.s~ │ ├── menu_temp.s │ ├── menu_temp.s~ │ ├── menu_temp_functions.s │ ├── menu_throttle.s │ ├── menu_throttle_functions.s │ ├── mim_calculations.s │ ├── motor_impedance_measurement.s │ ├── motor_impedance_measurement.s~ │ └── report_checksum.s ├── monitoring.s ├── motor_sinus.s ├── motor_sinus.s~ ├── nbproject │ ├── Makefile-default.mk │ ├── Makefile-genesis.properties │ ├── Makefile-impl.mk │ ├── Makefile-local-default.mk │ ├── Makefile-variables.mk │ ├── Package-default.bash │ ├── configurations.xml │ ├── private │ │ ├── SuppressibleMessageMemo.properties │ │ ├── configurations.xml │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml ├── phase_corrections.s ├── print_macros.mac ├── process_all_variables.s ├── prog_mem.s ├── random_i_imag.s ├── reset_vector.s ├── safety.s ├── show_matrix.s ├── show_matrix.s~ ├── sine_i_imag.s ├── speed_control.s ├── subrout_232.s ├── subrout_str.s ├── temp_macros.s ├── temp_routines.s ├── testprograms │ ├── tb_angle_amplitude.s │ ├── tb_discont_current_contr.s │ ├── tb_export_XY_coordinates.s │ ├── tb_filter_2nd_order.s │ ├── tb_filter_4th_order.s │ ├── tb_filter_dc_notch.s │ ├── tb_filter_lpf.s │ ├── tb_filter_notches.s │ ├── tb_find_dualtone_amplitude.s │ ├── tb_find_hf_amplitude.s │ ├── tb_first_motor_run.s │ ├── tb_first_motor_run.s~ │ ├── tb_first_motor_run_XY.s │ ├── tb_floatingpoint.s │ ├── tb_initial_gain_cal.s │ ├── tb_instability.s │ ├── tb_instability.s~ │ ├── tb_inv_vbat.s │ ├── tb_motor_run_hf_ampli_control.s │ ├── tb_motor_run_hf_ampli_control.s~ │ ├── tb_motor_run_hf_ampli_control_XY.s │ ├── tb_motor_run_hf_ampli_control_XY.s~ │ ├── tb_motor_run_hf_ampli_control_i_imag_control.s │ ├── tb_motor_sinus.s │ ├── tb_motor_sinus.s~ │ ├── tb_not_cont_PWM.s │ ├── tb_notch_filters.s │ ├── tb_position_from_inductances.s │ ├── tb_pwm_filter_notches.s │ ├── tb_sintable.s │ ├── tb_temp_read_ids.s │ ├── tb_temp_read_rom.s │ ├── tb_temp_reset.s │ ├── tb_transition.s │ └── tb_view_signals.s ├── throttle_open.s ├── throttle_ramp.s ├── throttle_read.s └── timers.s └── v2A1_.hex /DSC02269-800x800.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/DSC02269-800x800.jpg -------------------------------------------------------------------------------- /DSC02270-800x800.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/DSC02270-800x800.jpg -------------------------------------------------------------------------------- /DSC02271-800x800.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/DSC02271-800x800.jpg -------------------------------------------------------------------------------- /DSC02272-800x800.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/DSC02272-800x800.jpg -------------------------------------------------------------------------------- /DSC02273-800x800.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/DSC02273-800x800.jpg -------------------------------------------------------------------------------- /DSC02274-800x800.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/DSC02274-800x800.jpg -------------------------------------------------------------------------------- /DSC02275-800x800.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/DSC02275-800x800.jpg -------------------------------------------------------------------------------- /Screenshot from 2020-03-01 14-48-37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/Screenshot from 2020-03-01 14-48-37.png -------------------------------------------------------------------------------- /src/Lebowski_2A1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1.zip -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/LEDs.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global LEDs_open 6 | LEDs_open: 7 | 8 | bclr TRISC, #15 9 | bclr TRISC, #13 10 | bclr TRISC, #14 11 | bclr TRISE, #8 12 | 13 | bclr LATC, #15 14 | bclr LATC, #13 15 | bclr LATC, #14 16 | bclr LATE, #8 17 | 18 | return 19 | 20 | ;******************************************* 21 | .global LED_menu_error 22 | LED_menu_error: 23 | 24 | ;-------------------------------------- TMR1 blink rate 25 | 26 | bclr IEC0, #3 ;NO INTERRUPT ! 27 | mov #0b1000000000110000, w0 28 | mov w0, T1CON ;start TMR1, 1:256 pre-scale 29 | mov #30000, w0 30 | mov w0, PR1 ;blinkrate = (30e6/256) / PR1 31 | clr TMR1 32 | bclr IFS0, #3 33 | 34 | ;-------------------------------------- initialise LED's 35 | 36 | call LEDs_open 37 | 38 | bclr LATC, #15 39 | bset LATC, #13 40 | bclr LATC, #14 41 | bset LATE, #8 42 | 43 | ;-------------------------------------- endless blink loop 44 | 1: 45 | btss IFS0, #3 46 | bra 1b 47 | bclr IFS0, #3 48 | 49 | btg LATC, #15 50 | btg LATC, #13 51 | btg LATC, #14 52 | btg LATE, #8 53 | 54 | bra 1b 55 | 56 | .end 57 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # There exist several targets which are by default empty and which can be 3 | # used for execution of your targets. These targets are usually executed 4 | # before and after some main targets. They are: 5 | # 6 | # .build-pre: called before 'build' target 7 | # .build-post: called after 'build' target 8 | # .clean-pre: called before 'clean' target 9 | # .clean-post: called after 'clean' target 10 | # .clobber-pre: called before 'clobber' target 11 | # .clobber-post: called after 'clobber' target 12 | # .all-pre: called before 'all' target 13 | # .all-post: called after 'all' target 14 | # .help-pre: called before 'help' target 15 | # .help-post: called after 'help' target 16 | # 17 | # Targets beginning with '.' are not intended to be called on their own. 18 | # 19 | # Main targets can be executed directly, and they are: 20 | # 21 | # build build a specific configuration 22 | # clean remove built files from a configuration 23 | # clobber remove all built files 24 | # all build all configurations 25 | # help print help mesage 26 | # 27 | # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and 28 | # .help-impl are implemented in nbproject/makefile-impl.mk. 29 | # 30 | # Available make variables: 31 | # 32 | # CND_BASEDIR base directory for relative paths 33 | # CND_DISTDIR default top distribution directory (build artifacts) 34 | # CND_BUILDDIR default top build directory (object files, ...) 35 | # CONF name of current configuration 36 | # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) 37 | # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) 38 | # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) 39 | # CND_PACKAGE_DIR_${CONF} directory of package (current configuration) 40 | # CND_PACKAGE_NAME_${CONF} name of package (current configuration) 41 | # CND_PACKAGE_PATH_${CONF} path to package (current configuration) 42 | # 43 | # NOCDDL 44 | 45 | 46 | # Environment 47 | MKDIR=mkdir 48 | CP=cp 49 | CCADMIN=CCadmin 50 | RANLIB=ranlib 51 | 52 | 53 | # build 54 | build: .build-post 55 | 56 | .build-pre: 57 | # Add your pre 'build' code here... 58 | 59 | .build-post: .build-impl 60 | # Add your post 'build' code here... 61 | 62 | 63 | # clean 64 | clean: .clean-post 65 | 66 | .clean-pre: 67 | # Add your pre 'clean' code here... 68 | 69 | .clean-post: .clean-impl 70 | # Add your post 'clean' code here... 71 | 72 | 73 | # clobber 74 | clobber: .clobber-post 75 | 76 | .clobber-pre: 77 | # Add your pre 'clobber' code here... 78 | 79 | .clobber-post: .clobber-impl 80 | # Add your post 'clobber' code here... 81 | 82 | 83 | # all 84 | all: .all-post 85 | 86 | .all-pre: 87 | # Add your pre 'all' code here... 88 | 89 | .all-post: .all-impl 90 | # Add your post 'all' code here... 91 | 92 | 93 | # help 94 | help: .help-post 95 | 96 | .help-pre: 97 | # Add your pre 'help' code here... 98 | 99 | .help-post: .help-impl 100 | # Add your post 'help' code here... 101 | 102 | 103 | 104 | # include project implementation makefile 105 | include nbproject/Makefile-impl.mk 106 | 107 | # include project make variables 108 | include nbproject/Makefile-variables.mk 109 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/PWM.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global PWM_open 9 | PWM_open: 10 | ;pwm time base off for now, postscale 1:1, prescale 1:1, updown with dual update 11 | mov #0b0000000000000011, w0 12 | mov w0, PTCON 13 | ;50 kHz @ 30 MHz clock (30e6/50e3 = 600 / 2 because of updown = 300) 14 | mov pwm_period, w0 15 | mov w0, PTPER 16 | ;complementary mode, enable all pins for PWM use 17 | mov #0x0077, w0 18 | mov w0, PWMCON1 19 | ;update PDC registers and OSYNC on pwm boundary, updates enabled 20 | mov #0b0000000000000000, w0 21 | mov w0, PWMCON2 22 | ;configure only deadtime generator A, 15*33 = 500 ns dead time 23 | mov pwm_deadtime, w0 24 | mov w0, DTCON1 25 | ;no fault control A 26 | mov #0x0000, w0 27 | mov w0, FLTACON 28 | ;all pins controlled by PWM 29 | mov #0x3F00, w0 30 | mov w0, OVDCON 31 | ;initialise 50% dutycycle 32 | mov pwm_period, w0 33 | mov w0, PDC1 34 | mov w0, PDC2 35 | mov w0, PDC3 36 | 37 | return 38 | 39 | ;***************************************************************** 40 | 41 | .global PWM_continuous 42 | PWM_continuous: 43 | ;turn off before changing 44 | bclr PTCON, #15 45 | bset PTCON, #1 46 | 47 | mov pwm_period, w0 48 | mov w0, PTPER 49 | 50 | return 51 | 52 | ;***************************************************************** 53 | 54 | .global PWM_discontinuous 55 | PWM_discontinuous: 56 | ;turn off before changing 57 | bclr PTCON, #15 58 | bclr PTCON, #1 59 | 60 | mov pwm_period_rec, w0 61 | mov w0, PTPER 62 | 63 | 64 | return 65 | 66 | ;***************************************************************** 67 | 68 | 69 | .end 70 | 71 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/backemf_phase_control.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global backemf_phase_control 6 | ;w12: address of plic array 7 | ; 8 | ;corrupted registers: 9 | ;w1, w2, w9, w10, w11, w12 10 | backemf_phase_control: 11 | ;--------------------------------------- update phi and loopfilter 12 | ;w12 is at positive array position 13 | btsc flags2, #direction_phase_loop 14 | add w12, #10, w12 ;shift to negative if bit set (note the inversion !!!!!!) 15 | 16 | mov #phi_motor+2, w10 17 | mov #phi_int+2, w11 18 | 19 | mov [w12++], w1 ;w1.w2 to be added to phi_int 20 | mov [w12++], w2 21 | ;update phi_int with coefficients 22 | add w2, [w11], [w11--] 23 | addc w1, [w11], [w11++] 24 | 25 | mov [w12++], w1 ;w1.w2 to be added to phi_motor (this is the 1st integrator bypass path) 26 | mov [w12++], w2 27 | 28 | mov w1, phi_step 29 | ;add phi_int to the coefficients of phi 30 | add w2, [w11--], w2 31 | addc w1, [w11], w1 32 | ;and add to phi_motor 33 | add w2, [w10], [w10--] 34 | addc #0, w1 35 | add w1, [w10], [w10] 36 | ;and don't forget the phi_prop 37 | mov phi_prop, w2 38 | mov w2, phi_prop+2 39 | mov [w12], w2 40 | mov w2, phi_prop 41 | 42 | ;--------------------------------------- filter for speed control 43 | ;w1 is phi update 44 | mov #filt_spd_ctrl+2, w10 45 | ;x = x + a * (i - x) 46 | sub w1, [w10], w1 47 | mov #15000, w0 48 | mul.us w0, w1, w2 49 | 50 | add w2, [++w10], [w10--] 51 | addc w3, [w10], [w10] 52 | ;output = x + sgn(phi_prop) * feedforward_coefficient 53 | mov filt_spd_ctrl_ffcoef, w0 54 | btsc phi_prop, #15 55 | neg w0, w0 56 | add w0, [w10], [--w10] 57 | 58 | ;--------------------------------------- end 59 | 60 | return 61 | 62 | ;***************************************************************** 63 | 64 | 65 | .end 66 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/ADC.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/ADC.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/ADC.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/ADC.o: \ 2 | ./defines.inc \ 3 | ADC.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/LEDs.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/LEDs.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/LEDs.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/LEDs.o: \ 2 | ./defines.inc \ 3 | LEDs.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/PWM.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/PWM.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/PWM.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/PWM.o: \ 2 | ./defines.inc \ 3 | PWM.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/angle_amplitude.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/angle_amplitude.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/angle_amplitude.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/angle_amplitude.o: \ 2 | ./defines.inc \ 3 | angle_amplitude.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/backemf_phase_control.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/backemf_phase_control.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/backemf_phase_control.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/backemf_phase_control.o: \ 2 | ./defines.inc \ 3 | backemf_phase_control.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/calc_wanted_ampli_imag.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/calc_wanted_ampli_imag.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/calc_wanted_ampli_imag.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/calc_wanted_ampli_imag.o: \ 2 | ./defines.inc \ 3 | calc_wanted_ampli_imag.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/can_initialise.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/can_initialise.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/can_initialise.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/can_initialise.o: \ 2 | ./defines.inc \ 3 | can_initialise.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/can_motor.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/can_motor.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/can_motor.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/can_motor.o: \ 2 | ./defines.inc \ 3 | can_motor.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/chip_status.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/chip_status.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/chip_status.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/chip_status.o: \ 2 | ./fp_macros.mac \ 3 | ./print_macros.mac \ 4 | ./defines.inc \ 5 | chip_status.s 6 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/chip_update.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/chip_update.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/chip_update.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/chip_update.o: \ 2 | ./print_macros.mac \ 3 | ./defines.inc \ 4 | chip_update.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/correct_drive_selection.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/correct_drive_selection.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/correct_drive_selection.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/correct_drive_selection.o: \ 2 | ./defines.inc \ 3 | correct_drive_selection.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/current_control.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/current_control.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/current_control.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/current_control.o: \ 2 | ./defines.inc \ 3 | current_control.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/current_filtering.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/current_filtering.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/current_filtering.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/current_filtering.o: \ 2 | ./macros.mac \ 3 | ./defines.inc \ 4 | current_filtering.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/demod.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/demod.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/demod.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/demod.o: \ 2 | ./defines.inc \ 3 | demod.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/determine_update.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/determine_update.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/determine_update.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/determine_update.o: \ 2 | ./defines.inc \ 3 | determine_update.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_0_all.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_0_all.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_0_all.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/drive_0_all.o: \ 2 | ./defines.inc \ 3 | drive_0_all.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_1_all.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_1_all.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_1_all.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/drive_1_all.o: \ 2 | ./macros.mac \ 3 | ./fp_macros.mac \ 4 | ./defines.inc \ 5 | drive_1_all.s 6 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2_hall.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2_hall.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2_hall.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/drive_2_hall.o: \ 2 | ./macros.mac \ 3 | ./defines.inc \ 4 | drive_2_hall.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2_sensorless.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2_sensorless.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2_sensorless.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/drive_2_sensorless.o: \ 2 | ./macros.mac \ 3 | ./defines.inc \ 4 | drive_2_sensorless.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2to3_hall.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2to3_hall.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2to3_hall.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/drive_2to3_hall.o: \ 2 | ./fp_macros.mac \ 3 | ./defines.inc \ 4 | drive_2to3_hall.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2to3_sensorless.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2to3_sensorless.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_2to3_sensorless.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/drive_2to3_sensorless.o: \ 2 | ./macros.mac \ 3 | ./defines.inc \ 4 | drive_2to3_sensorless.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_3_all.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_3_all.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_3_all.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/drive_3_all.o: \ 2 | ./defines.inc \ 3 | drive_3_all.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_3_hall_measure.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_3_hall_measure.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_3_hall_measure.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/drive_3_hall_measure.o: \ 2 | ./defines.inc \ 3 | drive_3_hall_measure.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_3_measurement_functions.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_3_measurement_functions.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/drive_3_measurement_functions.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/drive_3_measurement_functions.o: \ 2 | ./macros.mac \ 3 | ./defines.inc \ 4 | drive_3_measurement_functions.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/fill_pwm_and_sin_arrays.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/fill_pwm_and_sin_arrays.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/fill_pwm_and_sin_arrays.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/fill_pwm_and_sin_arrays.o: \ 2 | ./defines.inc \ 3 | fill_pwm_and_sin_arrays.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/floating_point.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/floating_point.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/floating_point.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/floating_point.o: \ 2 | ./print_macros.mac \ 3 | ./defines.inc \ 4 | floating_point.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/global_variables.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/global_variables.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/global_variables.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/global_variables.o: \ 2 | ./defines.inc \ 3 | global_variables.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/hallbased_phase_control.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/hallbased_phase_control.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/hallbased_phase_control.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/hallbased_phase_control.o: \ 2 | ./defines.inc \ 3 | hallbased_phase_control.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/halls.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/halls.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/halls.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/halls.o: \ 2 | ./macros.mac \ 3 | ./defines.inc \ 4 | halls.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_collect_data.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_collect_data.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_collect_data.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/imp_collect_data.o: \ 2 | ./fp_macros.mac \ 3 | ./defines.inc \ 4 | imp_collect_data.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_collect_data_L.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_collect_data_L.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_collect_data_L.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/imp_collect_data_L.o: \ 2 | ./macros.mac \ 3 | ./fp_macros.mac \ 4 | ./defines.inc \ 5 | imp_collect_data_L.s 6 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_collect_data_R.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_collect_data_R.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_collect_data_R.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/imp_collect_data_R.o: \ 2 | ./fp_macros.mac \ 3 | ./defines.inc \ 4 | imp_collect_data_R.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_process_data.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_process_data.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/imp_process_data.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/imp_process_data.o: \ 2 | ./print_macros.mac \ 3 | ./fp_macros.mac \ 4 | ./defines.inc \ 5 | imp_process_data.s 6 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/init_interrupts.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/init_interrupts.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/init_interrupts.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/init_interrupts.o: \ 2 | init_interrupts.s 3 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/initialise.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/initialise.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/initialise.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/initialise.o: \ 2 | ./defines.inc \ 3 | initialise.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/inverse_vbat.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/inverse_vbat.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/inverse_vbat.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/inverse_vbat.o: \ 2 | ./defines.inc \ 3 | inverse_vbat.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/main_motor.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/main_motor.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/main_motor.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/main_motor.o: \ 2 | ./defines.inc \ 3 | main_motor.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/calc_rom_variables.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/calc_rom_variables.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/calc_rom_variables.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/calc_rom_variables.o: \ 2 | ./fp_macros.mac \ 3 | ./defines.inc \ 4 | menu\ structure/calc_rom_variables.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/convert_to_readable_L_and_R.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/convert_to_readable_L_and_R.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/convert_to_readable_L_and_R.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/convert_to_readable_L_and_R.o: \ 2 | ./fp_macros.mac \ 3 | ./print_macros.mac \ 4 | ./defines.inc \ 5 | menu\ structure/convert_to_readable_L_and_R.s 6 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/current_sensor_offset_measurement.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/current_sensor_offset_measurement.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/current_sensor_offset_measurement.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/current_sensor_offset_measurement.o: \ 2 | ./macros.mac \ 3 | ./defines.inc \ 4 | menu\ structure/current_sensor_offset_measurement.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/main_menu.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/main_menu.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/main_menu.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/main_menu.o: \ 2 | ./print_macros.mac \ 3 | ./defines.inc \ 4 | menu\ structure/main_menu.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_KvLR.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_KvLR.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_KvLR.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_KvLR.o: \ 2 | ./print_macros.mac \ 3 | ./defines.inc \ 4 | menu\ structure/menu_KvLR.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_battery.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_battery.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_battery.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_battery.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_battery.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_can.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_can.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_can.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_can.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_can.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_currents.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_currents.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_currents.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_currents.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_currents.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_erpms.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_erpms.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_erpms.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_erpms.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_erpms.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_filters.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_filters.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_filters.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_filters.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_filters.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_foc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_foc.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_foc.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_foc.o: \ 2 | ./print_macros.mac \ 3 | ./defines.inc \ 4 | menu\ structure/menu_foc.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_functions.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_functions.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_functions.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_functions.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_functions.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_halls.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_halls.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_halls.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_halls.o: \ 2 | ./fp_macros.mac \ 3 | ./print_macros.mac \ 4 | ./defines.inc \ 5 | menu\ structure/menu_halls.s 6 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_loop_coeffs.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_loop_coeffs.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_loop_coeffs.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_loop_coeffs.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_loop_coeffs.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_misc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_misc.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_misc.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_misc.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_misc.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_pwm.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_pwm.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_pwm.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_pwm.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_pwm.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_recov.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_recov.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_recov.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_recov.o: \ 2 | ./print_macros.mac \ 3 | ./defines.inc \ 4 | menu\ structure/menu_recov.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_rom.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_rom.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_rom.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_rom.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_rom.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_sensors.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_sensors.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_sensors.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_sensors.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_sensors.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_stored_status.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_stored_status.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_stored_status.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_stored_status.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_stored_status.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_temp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_temp.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_temp.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_temp.o: \ 2 | ./temp_macros.s \ 3 | ./defines.inc \ 4 | menu\ structure/menu_temp.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_temp_functions.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_temp_functions.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_temp_functions.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_temp_functions.o: \ 2 | ./temp_macros.s \ 3 | ./defines.inc \ 4 | menu\ structure/menu_temp_functions.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_throttle.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_throttle.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_throttle.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_throttle.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_throttle.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_throttle_functions.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_throttle_functions.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/menu_throttle_functions.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/menu_throttle_functions.o: \ 2 | ./defines.inc \ 3 | menu\ structure/menu_throttle_functions.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/mim_calculations.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/mim_calculations.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/mim_calculations.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/mim_calculations.o: \ 2 | ./print_macros.mac \ 3 | ./defines.inc \ 4 | menu\ structure/mim_calculations.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/motor_impedance_measurement.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/motor_impedance_measurement.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/motor_impedance_measurement.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/motor_impedance_measurement.o: \ 2 | ./defines.inc \ 3 | menu\ structure/motor_impedance_measurement.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/report_checksum.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/report_checksum.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/menu structure/report_checksum.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/menu\ structure/report_checksum.o: \ 2 | ./defines.inc \ 3 | menu\ structure/report_checksum.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/monitoring.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/monitoring.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/monitoring.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/monitoring.o: \ 2 | ./defines.inc \ 3 | monitoring.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/motor_sinus.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/motor_sinus.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/motor_sinus.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/motor_sinus.o: \ 2 | ./defines.inc \ 3 | motor_sinus.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/process_all_variables.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/process_all_variables.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/process_all_variables.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/process_all_variables.o: \ 2 | ./defines.inc \ 3 | process_all_variables.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/prog_mem.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/prog_mem.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/prog_mem.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/prog_mem.o: \ 2 | ./print_macros.mac \ 3 | ./defines.inc \ 4 | prog_mem.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/reset_vector.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/reset_vector.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/reset_vector.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/reset_vector.o: \ 2 | reset_vector.s 3 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/safety.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/safety.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/safety.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/safety.o: \ 2 | ./macros.mac \ 3 | ./defines.inc \ 4 | safety.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/sine_i_imag.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/sine_i_imag.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/sine_i_imag.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/sine_i_imag.o: \ 2 | ./defines.inc \ 3 | sine_i_imag.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/speed_control.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/speed_control.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/speed_control.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/speed_control.o: \ 2 | ./defines.inc \ 3 | speed_control.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/subrout_232.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/subrout_232.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/subrout_232.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/subrout_232.o: \ 2 | subrout_232.s 3 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/subrout_str.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/subrout_str.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/subrout_str.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/subrout_str.o: \ 2 | ./defines.inc \ 3 | subrout_str.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/temp_macros.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/temp_macros.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/temp_macros.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/temp_macros.o: \ 2 | temp_macros.s 3 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/temp_routines.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/temp_routines.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/temp_routines.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/temp_routines.o: \ 2 | ./temp_macros.s \ 3 | ./defines.inc \ 4 | temp_routines.s 5 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/throttle_open.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/throttle_open.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/throttle_open.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/throttle_open.o: \ 2 | ./defines.inc \ 3 | throttle_open.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/throttle_ramp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/throttle_ramp.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/throttle_ramp.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/throttle_ramp.o: \ 2 | ./defines.inc \ 3 | throttle_ramp.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/throttle_read.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/throttle_read.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/throttle_read.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/throttle_read.o: \ 2 | ./defines.inc \ 3 | throttle_read.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/timers.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/timers.o -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/build/default/production/timers.o.d: -------------------------------------------------------------------------------- 1 | build/default/production/timers.o: \ 2 | ./defines.inc \ 3 | timers.s 4 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/can_initialise.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global CAN_open_RX 6 | CAN_open_RX: 7 | ;-------------------------------------- request and wait for CAN configuration mode 8 | 9 | mov #0x0C00, w0 10 | mov w0, C1CTRL 11 | 12 | mov #0x00E0, w1 ;request accepted mask 13 | mov #0x0080, w2 ;request accepted code 14 | cor_req_lp: 15 | mov w1, w0 16 | and C1CTRL, wreg 17 | cpseq w0, w2 18 | bra cor_req_lp 19 | 20 | ;-------------------------------------- initialise CAN 21 | ;CAN clk=Fcy, no interrupts 22 | mov #0x0C00, w0 23 | mov w0, C1CTRL 24 | ;no RXB0 buffer overflow 25 | mov #0, w0 26 | mov w0, C1RX0CON 27 | 28 | mov #0, w0 29 | mov w0, C1RX1CON 30 | ;message acceptance mask, RXB0, match all bits, 31 | mov #0b0001111111111101, w0 32 | mov w0, C1RXM0SID 33 | ;mask filter RXF0, '16', throttle_raw1 and throttle_raw2 34 | ; mov #0b0000000001000000, w0 35 | mov can_rxsid, w0 36 | mov w0, C1RXF0SID 37 | ;mask filter RXF1, '2047', not used 38 | mov #0b0001111111111100, w0 39 | mov w0, C1RXF1SID 40 | ;Tq pattern: S PP 1111 222 (100 kbaud with Tq = 1usec) 41 | ; mov #0b0000001010011000, w0 42 | mov can_cfg2, w0 43 | mov w0, C1CFG2 44 | ;SJW = 1, BPR = 14 for Tq = 1 usec @ 30 MHz 45 | ; mov #0b0000000000001110, w0 46 | mov can_cfg1, w0 47 | mov w0, C1CFG1 48 | 49 | ;-------------------------------------- enable interrupt on RXB0 50 | 51 | bclr C1INTF, #0 52 | bset C1INTE, #0 53 | ;set CAN1 interrupt level to 4 54 | bset IPC6, #14 55 | bclr IPC6, #13 56 | bclr IPC6, #12 57 | ;enable CAN interrupts in general 58 | bclr IFS1, #11 59 | bset IEC1, #11 60 | 61 | ;-------------------------------------- set in operational mode 62 | 63 | bclr C1CTRL, #10 64 | bset C1CTRL, #15 65 | 66 | return 67 | 68 | ;************************************************************ 69 | 70 | .global CAN_open_TX 71 | CAN_open_TX: 72 | ;-------------------------------------- request and wait for CAN configuration mode 73 | 74 | mov #0x0C00, w0 75 | mov w0, C1CTRL 76 | 77 | mov #0x00E0, w1 ;request accepted mask 78 | mov #0x0080, w2 ;request accepted code 79 | cot_req_lp: 80 | mov w1, w0 81 | and C1CTRL, wreg 82 | cpseq w0, w2 83 | bra cot_req_lp 84 | 85 | ;-------------------------------------- initialise CAN 86 | ;CAN clk=Fcy, no interrupts 87 | mov #0x0C00, w0 88 | mov w0, C1CTRL 89 | ;lowest priority messages 90 | clr C1TX0CON 91 | clr C1TX1CON 92 | ;Tq pattern: S PP 1111 222 (100 kbaud with Tq = 1usec) 93 | ; mov #0b0000001010011000, w0 94 | mov can_cfg2, w0 95 | mov w0, C1CFG2 96 | ;SJW = 1, BPR = 14 for Tq = 1 usec @ 30 MHz 97 | ; mov #0b0000000000001110, w0 98 | mov can_cfg1, w0 99 | mov w0, C1CFG1 100 | 101 | ;-------------------------------------- disable RX ? 102 | ;-------------------------------------- no interrupts in TX mode 103 | 104 | clr C1INTE 105 | bclr IEC1, #11 106 | 107 | ;-------------------------------------- set in operational mode 108 | 109 | bclr C1CTRL, #10 110 | bset C1CTRL, #15 111 | 112 | return 113 | 114 | ;************************************************************ 115 | 116 | 117 | .end 118 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/can_motor.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;this is the CAN bus interrupt routine. It gets called 7 | ;when a new message is received in RXB0, filter0 8 | ;filter 0: throttle input 9 | 10 | .section *,code ;,address (0x58D0) 11 | 12 | .global __C1Interrupt 13 | __C1Interrupt: 14 | 15 | ;--------------------------------------- save registers 16 | ;w0-w3 17 | push.s 18 | 19 | ;--------------------------------------- make sure its an RXB0 interrupt 20 | 21 | btss C1INTF, #0 22 | bra c1i_end 23 | 24 | ;--------------------------------------- only accept filter 0, else end 25 | 26 | btsc C1RX0CON, #0 27 | bra c1i_end 28 | 29 | ;--------------------------------------- make sure buffer full, there's 2 data bytes 30 | ;buffer full ? 31 | btss C1RX0CON, #7 32 | bra c1i_end 33 | bclr C1RX0CON, #7 34 | ;6 bytes ? 35 | mov #0x000F, w0 36 | and C1RX0DLC, wreg 37 | cp w0, #6 38 | bra nz, c1i_end 39 | 40 | ;--------------------------------------- read data, assign to throttle_rawx 41 | 42 | mov C1RX0B1, w0 43 | mov w0, throttle_raw1 44 | mov C1RX0B2, w0 45 | mov w0, throttle_raw2 46 | mov C1RX0B3, w0 47 | mov w0, flags_CAN 48 | 49 | ;--------------------------------------- process the received flags 50 | 51 | bclr flags1, #reverse_request 52 | btsc flags_CAN, #reverse_CAN 53 | bset flags1, #reverse_request 54 | 55 | ;--------------------------------------- compute wanted_i_real according to polynomals 56 | 57 | push w10 58 | push w11 59 | push w12 60 | push w13 61 | 62 | call throttle_rawx_to_wanted_i_real 63 | 64 | pop w13 65 | pop w12 66 | pop w11 67 | pop w10 68 | 69 | ;--------------------------------------- end 70 | c1i_end: 71 | bclr C1INTF, #0 72 | bclr IFS1, #11 73 | pop.s 74 | retfie 75 | 76 | ;*************************************** 77 | 78 | .global CAN_tx_throttle 79 | CAN_tx_throttle: 80 | ;re-build flags_CAN 81 | clr flags_CAN 82 | btsc flags1, #reverse_request 83 | bset flags_CAN, #reverse_CAN 84 | 85 | mov throttle_raw1, w0 86 | mov w0, C1TX0B1 87 | mov throttle_raw2, w0 88 | mov w0, C1TX0B2 89 | mov flags_CAN, w0 90 | mov w0, C1TX0B3 91 | 92 | mov #0x0030, w0 ;6 bytes, no extended ID 93 | mov w0, C1TX0DLC 94 | 95 | ;tx ID 96 | mov can_txsid, w0 97 | mov w0, C1TX0SID 98 | 99 | bset C1TX0CON, #3 ;set TXREQ 100 | 101 | return 102 | 103 | ;*************************************** 104 | 105 | .end 106 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/check_phase_loop_fpversion.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | .include "fp_macros.mac" 4 | 5 | .text 6 | 7 | .global check_phase_loop 8 | ; 9 | ;when all is well: 10 | ; (Va / invvbat) = Kv*w + Ia*R - Ib*w*L 11 | ; 12 | ;if too much deviation -> force phase loop in correct direction (based on w) 13 | ; 14 | check_phase_loop: 15 | ;--------------------------------------- only when allowed (when Kv, L and R current) 16 | bclr flags2, #use_emergency_coeffs 17 | 18 | btss flags2, #allow_check_phase_loop 19 | return 20 | ;--------------------------------------- w10 = Va - Ia*R*invvbat 21 | mov filter_I+4, w0 22 | mov filter_inv_vbat, w1 23 | mul.us w1, w0, w2 24 | signed32_w3w2_to_fp regA 25 | 26 | mov #real_impedance, w12 27 | mov #regA, w13 28 | mov #16, w0 ;not done in signed32_to_fp ! 29 | add w0, [w13], [w13] 30 | call fp_mult 31 | 32 | fp_to_int regA w10 33 | 34 | mov ampli_real, w0 35 | sub w0, w10, w10 36 | btss SR, #OV 37 | bra 1f 38 | mov #0x7FFF, w10 39 | btsc ampli_real, #15 40 | mov #0x8001, w10 41 | 1: 42 | mov w10, dummy1 43 | ;--------------------------------------- w11 = (kV - Ib*L) * w * invvbat 44 | neg filter_Q+4, wreg 45 | signed_w0_to_fp regA 46 | mov #imag_impedance, w12 47 | mov #regA, w13 48 | call fp_mult 49 | mov #Kv, w12 50 | call fp_add 51 | 52 | mov phi_int, w0 53 | mov filter_inv_vbat, w1 54 | mul.us w1, w0, w2 55 | signed32_w3w2_to_fp regB 56 | 57 | mov #regB, w12 58 | mov #16, w0 ;not done in signed32_to_fp ! 59 | add w0, [w12], [w12] 60 | call fp_mult 61 | 62 | fp_to_int regA w11 63 | mov w11, dummy2 64 | ;--------------------------------------- which of the 4 cases? 65 | ;prepare the margin (0.125 of w10) to w0 66 | asr w10, #3, w0 67 | 68 | btsc flags1, #reverse 69 | bra cpl_reverse 70 | ;forward 71 | cpl_forward: 72 | btss flags2, #direction_phase_loop 73 | bra forward_advance 74 | return 75 | ;reverse 76 | cpl_reverse: 77 | btss flags2, #direction_phase_loop 78 | return 79 | bra reverse_retard 80 | 81 | forward_advance: 82 | ;invoke when w11 > 1.125 w10, or w11 - 0.125 * w10 > w10 83 | sub w11, w0, w11 84 | cpslt w11, w10 85 | bra cpl_invoke 86 | return 87 | /* 88 | forward_retard: 89 | ;invoke when w11 < 0.875 w10 90 | sub w10, w0, w10 91 | cpsgt w11, w10 92 | bra cpl_invoke 93 | return 94 | 95 | reverse_advance: 96 | ;invoke when w11 > 0.875 w10 97 | sub w10, w0, w10 98 | cpslt w11, w10 99 | bra cpl_invoke 100 | return 101 | */ 102 | reverse_retard: 103 | ;invoke when w11 < 1.125 w10, or w11 - 0.125 w10 < w10 104 | sub w11, w0, w11 105 | cpsgt w11, w10 106 | bra cpl_invoke 107 | return 108 | 109 | ;--------------------------------------- invoke emergency coeffs 110 | cpl_invoke: 111 | 112 | bset flags2, #use_emergency_coeffs 113 | ;no data collection 114 | bclr flags1, #valid_data_imp_meas 115 | 116 | return 117 | 118 | 119 | 120 | 121 | 122 | /* 123 | nop 124 | nop 125 | nop 126 | ;Kv, w=1400 at va=0x7FFF 127 | mov #0xFFE6, w0 128 | mov w0, Kv 129 | mov #0x5DFC, w0 130 | mov w0, Kv+2 131 | ;154 mOhm 132 | mov #0xFFE1, w0 133 | mov w0, real_impedance 134 | mov #0x5826, w0 135 | mov w0, real_impedance+2 136 | ;145.8 uH 137 | mov #0xFFD8, w0 138 | mov w0, imag_impedance 139 | mov #0x7480, w0 140 | mov w0, imag_impedance+2 141 | ;w=500 <=> 217 Hz 142 | mov #500, w0 143 | mov w0, phi_int 144 | ;Ia = 10 A 145 | mov #1966, w0 146 | mov w0, filter_I+4 147 | ;Ib = 3A 148 | mov #590, w0 149 | mov w0, filter_Q+4 150 | 151 | setm filter_inv_vbat 152 | */ 153 | 154 | 155 | .end 156 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum: -------------------------------------------------------------------------------- 1 | CHECKSUM : 9D76 A98F 25C6 2 | 3 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum 2818~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum 2818~ -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum2815~: -------------------------------------------------------------------------------- 1 | CHECKSUM : 7264 BE01 B468 2 | 3 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum2816~: -------------------------------------------------------------------------------- 1 | CHECKSUM : 9EB6 EB14 D51F 2 | 3 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum2817~: -------------------------------------------------------------------------------- 1 | CHECKSUM : 7948 2312 D091 2 | 3 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum290_~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum290_~ -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum_han1~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum_han1~ -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/checksum~: -------------------------------------------------------------------------------- 1 | CHECKSUM : 4B82 7913 5D9B 2 | 3 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/correct_drive_selection.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global correct_drive_2 9 | correct_drive_2: 10 | 11 | ;--------------------------------------- maybe force drive_2_sensorless, only when allow_rom_write 12 | btss flags_rom, #allow_rom_write 13 | bra no_force_dr2 14 | ;force drive_2_sensorless when flags_rom, #calib_halls set 15 | btsc flags_rom, #calib_halls 16 | goto initialise_drive_2_sensorless 17 | 18 | no_force_dr2: 19 | ;--------------------------------------- drive_2_hall when selected 20 | 21 | btsc flags_rom, #hall_mode 22 | goto initialise_drive_2_hall 23 | 24 | ;--------------------------------------- drive_2_sensorless as last resort 25 | goto initialise_drive_2_sensorless 26 | 27 | 28 | ;***************************************************************** 29 | 30 | .global correct_drive_2to3 31 | correct_drive_2to3: 32 | ;--------------------------------------- maybe force drive_2to3_sensorless, only when allow_rom_write 33 | btss flags_rom, #allow_rom_write 34 | bra no_force_dr2to3 35 | ;force drive_2to3_sensorless when flags_rom, #calib_halls set 36 | btsc flags_rom, #calib_halls 37 | goto initialise_drive_2to3_sensorless 38 | 39 | no_force_dr2to3: 40 | ;--------------------------------------- drive_2to3_hall when selected 41 | 42 | btsc flags_rom, #hall_mode 43 | goto initialise_drive_2to3_hall 44 | 45 | ;--------------------------------------- drive_2to3_sensorless as last resort 46 | goto initialise_drive_2to3_sensorless 47 | 48 | ;***************************************************************** 49 | 50 | .global correct_drive_3 51 | correct_drive_3: 52 | 53 | ;--------------------------------------- when selected: go to drive_3_hall_measure 54 | btss flags_rom, #allow_rom_write 55 | bra no_force_dr3 56 | 57 | btsc flags_rom, #calib_halls 58 | goto initialise_drive_3_hall_measure 59 | 60 | ;--------------------------------------- else go to the normal one. 61 | no_force_dr3: 62 | goto initialise_drive_3_all 63 | 64 | ;***************************************************************** 65 | 66 | .end 67 | 68 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/current_filtering.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | .include "macros.mac" 4 | 5 | .text 6 | 7 | ;***************************************************************** 8 | 9 | .global current_filtering 10 | current_filtering: 11 | 12 | ;--------------------------------------- filter i_real for FOC and measurement 13 | mov w8, filter_I 14 | 15 | mov #filter_w8, w13 16 | mov fil2ord_i_meas, w11 17 | filter w8 18 | 19 | ;--------------------------------------- filter i_imag for FOC and measurement 20 | mov w9, filter_Q 21 | 22 | mov #filter_w9, w13 23 | filter w9 24 | 25 | ;--------------------------------------- filter wanted_i_real with dr23 error current filter, for proportional error current part 26 | 27 | mov wanted_i_real, w0 28 | mov #filter_wir, w13 29 | filter w0 30 | 31 | ;--------------------------------------- filter 1/V_battery 32 | 33 | call inverse_vbat 34 | 35 | ;--------------------------------------- filter V_battery 36 | 37 | mov #filter_vbat, w13 38 | mov supply_voltage, w0 39 | sl w0, #6, w0 ;times 64 as ADC outputs raw integer 40 | ;calc difference, mult with coeff 41 | sub w0, [w13], w0 42 | mov vbat_filt_coeff, w1 43 | mul.us w1, w0, w2 44 | ;times 2^-8 45 | lsr w2, #8, w0 46 | sl w3, #8, w1 47 | ior w0, w1, w0 48 | asr w3, #8, w1 49 | ;add to filter integrator 50 | add w0, [++w13], [w13] 51 | addc w1, [--w13], [w13] 52 | 53 | ;--------------------------------------- end 54 | 55 | return 56 | 57 | ;***************************************************************** 58 | 59 | 60 | 61 | 62 | .end 63 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/current_filtering.s~: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global positive_demod 9 | ; w0: phase 10 | ; w4,5,6: phase currents 11 | ; after routine 12 | ; w8: I or X 13 | ; w9: Q or Y 14 | ; 15 | ; corrupted variables: 16 | ; w0, w1, w2, w3, w13 17 | positive_demod: 18 | ;--------------------------------------- find sin position in array [w13] before corrupting w0 19 | lsr w0, #7, w13 20 | bclr w13, #0 21 | bset w13, #11 22 | ;--------------------------------------- w3 = sin(120) * [w5-w6] 23 | sub w5, w6, w0 24 | mov #56756, w1 25 | mul.us w1, w0, w2 26 | ;--------------------------------------- w2 = w4 - [w5+w6]/2 27 | add w5, w6, w2 28 | asr w2, w2 29 | sub w4, w2, w2 30 | ;--------------------------------------- w9 = w3*sin(phi) 31 | mul.ss w3, [w13], w8 32 | ;--------------------------------------- w8 = w2*sin(phi) 33 | mul.ss w2, [w13], w0 34 | mov w1, w8 35 | ;--------------------------------------- to cos position in array 36 | add #128, w13 37 | bclr w13, #9 38 | ;--------------------------------------- w9 = w2*cos(phi) - w9 39 | mul.ss w2, [w13], w0 40 | sub w1, w9, w9 41 | ;--------------------------------------- w8 = w8 + w3*cos(phi) 42 | mul.ss w3, [w13], w0 43 | add w8, w1, w8 44 | ;--------------------------------------- end 45 | return 46 | 47 | ;***************************************************************** 48 | 49 | .global negative_demod 50 | ; 51 | ; same as positive demod 52 | ; but with w5 and w6 interchanged 53 | ; which only affects the calculation of (the internal variable) w3 54 | ; 55 | ; w0: phase 56 | ; w4,5,6: phase currents 57 | ; after routine 58 | ; w8: I or X 59 | ; w9: Q or Y 60 | ; 61 | ; corrupted variables: 62 | ; w0, w1, w2, w3, w13 63 | negative_demod: 64 | ;--------------------------------------- find sin position in array [w13] before corrupting w0 65 | lsr w0, #7, w13 66 | bclr w13, #0 67 | bset w13, #11 68 | ;--------------------------------------- w3 = sin(120) * [w6-w5] 69 | sub w6, w5, w0 70 | mov #56756, w1 71 | mul.us w1, w0, w2 72 | ;--------------------------------------- w2 = w4 - [w5+w6]/2 73 | add w5, w6, w2 74 | asr w2, w2 75 | sub w4, w2, w2 76 | ;--------------------------------------- w9 = w3*sin(phi) 77 | mul.ss w3, [w13], w8 78 | ;--------------------------------------- w8 = w2*sin(phi) 79 | mul.ss w2, [w13], w0 80 | mov w1, w8 81 | ;--------------------------------------- to cos position in array 82 | add #128, w13 83 | bclr w13, #9 84 | ;--------------------------------------- w9 = w2*cos(phi) - w9 85 | mul.ss w2, [w13], w0 86 | sub w1, w9, w9 87 | ;--------------------------------------- w8 = w8 + w3*cos(phi) 88 | mul.ss w3, [w13], w0 89 | add w8, w1, w8 90 | ;--------------------------------------- end 91 | return 92 | 93 | ;***************************************************************** 94 | 95 | .end 96 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/disect_current.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global disect_current 9 | disect_current: 10 | ;--------------------------------------- calculate phase current values 11 | 12 | mov phi_disect, w0 13 | ;measured currents are already in w4, w5, w6 14 | ;--------------------------------------- disect currents into real and imaginary part, store i_real, i_imag 15 | ;calculate address in sine array 16 | lsr w0, #7, w10 17 | bclr w10, #0 18 | bset w10, #11 19 | bset w10, #10 20 | ;calculate i_real, start with phase A, add B, add C 21 | mul.ss w4, [w10], w0 22 | mov w1, w8 23 | 24 | add #170, w10 25 | bclr w10, #9 26 | mul.ss w5, [w10], w0 27 | add w1, w8, w8 28 | 29 | add #172, w10 30 | bclr w10, #9 31 | mul.ss w6, [w10], w0 32 | add w1, w8, w8 33 | ;calculate i_imag 34 | ;move to -cos in array 35 | add #42, w10 36 | bclr w10, #9 37 | mul.ss w4, [w10], w0 38 | mov w1, w9 39 | 40 | add #170, w10 41 | bclr w10, #9 42 | mul.ss w5, [w10], w0 43 | add w1, w9, w9 44 | 45 | add #172, w10 46 | bclr w10, #9 47 | mul.ss w6, [w10], w0 48 | add w1, w9, w9 49 | 50 | ;--------------------------------------- perform comb filtering if requested 51 | 52 | btss flags_rom, #comb_filter 53 | bra dc_store 54 | 55 | mov w8_nm1, w6 56 | mov w9_nm1, w7 57 | 58 | mov w8, w8_nm1 59 | mov w9, w9_nm1 60 | 61 | add w6, w8, w8 62 | asr w8, w8 63 | add w7, w9, w9 64 | asr w9, w9 65 | 66 | ;--------------------------------------- store I_real, I_imag 67 | dc_store: 68 | 69 | mov w8, i_real 70 | mov w9, i_imag 71 | ;invert i_imag if we're in reverse 72 | sl direction, wreg 73 | xor i_imag 74 | 75 | ;--------------------------------------- filter i_real 76 | ;filt[n] = filt[n-1] + alpha * ( I[n] - filt[n-1] ) 77 | mov i_real_filtcoef, w1 78 | 79 | mov i_real, w0 80 | subr i_real_filt, wreg ;i[n] - filt[n-1] 81 | asr w0, w1, w0 ;alpha = 1/(2^filtercoefficient+1) 82 | asr w0, w0 ;separate asr statement to rotate remainder into carry 83 | addc i_real_filt ;filt[n] = filt[n-1] + alpha * ( I[n] - filt[n-1] ) 84 | 85 | ;--------------------------------------- filter i_imag 86 | mov i_imag_filtcoef, w1 87 | ;filt[n] = filt[n-1] + alpha * ( I[n] - filt[n-1] ) 88 | mov i_imag, w0 89 | subr i_imag_filt, wreg ;i[n] - filt[n-1] 90 | asr w0, w1, w0 ;alpha = 1/(2^filtercoefficient+1) 91 | asr w0, w0 ;separate asr statement to rotate remainder into carry 92 | addc i_imag_filt ;filt[n] = filt[n-1] + alpha * ( I[n] - filt[n-1] ) 93 | 94 | ;--------------------------------------- end 95 | 96 | return 97 | 98 | ;***************************************************************** 99 | 100 | .bss 101 | w8_nm1: .space 2 ;keep previous value for comb filtering 102 | w9_nm1: .space 2 ;keep previous value for comb filtering 103 | 104 | .end 105 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/dist/default/production/30F_powerstart_v2pA1.X.production.cof: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/dist/default/production/30F_powerstart_v2pA1.X.production.cof -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/dist/default/production/memoryfile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | bytes 7 | 2048 8 | 1810 9 | 238 10 | 11 | 12 | bytes 13 | 48768 14 | 48612 15 | 156 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/drive_3_hall_measure.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | .global initialise_drive_3_hall_measure 7 | initialise_drive_3_hall_measure: 8 | ;indicate drive_3 and drive_0 9 | bset LATC, #15 10 | bclr LATC, #13 11 | bclr LATC, #14 12 | bset LATE, #8 13 | ;clear shutdown bits 14 | bclr flags1, #over_i_imag 15 | bclr flags1, #over_erpm 16 | 17 | ;---------------------------------------------- save variables 18 | ;save and clear max fieldweakening current 19 | push max_fieldweak_ratio 20 | clr max_fieldweak_ratio 21 | ;---------------------------------------------- spool up to high erpm 22 | ;use phi_int_hall_measure 23 | mov phi_int_hall_measure, w0 24 | btsc flags1, #reverse 25 | neg w0, w0 26 | mov w0, wanted_phi_int 27 | mov #10, w0 28 | mov w0, filt_spd_ctrl_ffcoef 29 | 30 | call to_erpm 31 | 32 | ;---------------------------------------------- at high erpm, measure 33 | ;- erpm at 100% amplitude, for compensation of magnetic angle 34 | ;- hall positions 35 | call measure_halls 36 | 37 | call build_hall_array 38 | 39 | ;---------------------------------------------- recover variables 40 | 41 | pop max_fieldweak_ratio 42 | 43 | ;---------------------------------------------- end by saving 44 | goto online_store_in_progmem 45 | 46 | .end 47 | 48 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/drive_3_measurement_calculations.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | ;* calculate phi_int at 100 % amplitude 8 | ;***************************************************************** 9 | 10 | .global calculate_phi_int_100 11 | calculate_phi_int_100: 12 | ;---------------------------------------------- phi_int_100 = 2^-16 * inv_vbat0 * phi_int / (ampli_real - I*R) 13 | ;recover phi_int, make positive 14 | mov filter_spd+4, w1 15 | btsc w1, #15 16 | neg w1, w1 17 | clr w0 18 | ;recover ampli_real-I*R, make positive 19 | mov filter_general+4, w2 20 | btsc w2, #15 21 | neg w2, w2 22 | ;double amplitude as now in [0..1] instead of [-1..1] 23 | sl w2, w2 24 | 25 | repeat #17 26 | div.ud w0, w2 27 | ;phi_int_max_display = phi_int / (ampli_real - I*R) 28 | mov w0, phi_int_max_display 29 | 30 | return 31 | 32 | 33 | ;***************************************************************** 34 | ;* calculate mfa_x 35 | ;***************************************************************** 36 | 37 | .global calculate_mfa_x 38 | calculate_mfa_x: 39 | ;---------------------------------------------- mfa_x = 2^-39 * induct_scale * imag_impedance * phi_int_max_display * inv_vbat0 40 | ;---------------------------------------------- induct_scale * inv_vbat0 41 | mov induct_scale, w0 42 | mov filter_inv_vbat, w1 43 | mul.uu w0, w1, w2 44 | ;w3:w2 = induct_scale * inv_vbat0 45 | ;---------------------------------------------- phi_int_max_display * induct_scale * inv_vbat0 46 | mov phi_int_max_display, w0 47 | mul.uu w2, w0, w4 ;00:w5:w4 = 0.U.U 48 | mul.uu w3, w0, w2 ;w3:w2:00 = V.V.0 49 | 50 | sl w4, w4 51 | addc w5, w2, w2 52 | addc w3, #0, w3 53 | ;w3:w2 = 2^-16 * phi_int_max_display * induct_scale * inv_vbat0 54 | ;---------------------------------------------- * imag_impedance 55 | mov imag_impedance, w0 56 | mul.uu w2, w0, w4 ;00:w5:w4 = 0.U.U 57 | mul.uu w3, w0, w2 ;w3:w2:00 = V.V.0 58 | 59 | sl w4, w4 60 | addc w5, w2, w2 61 | addc w3, #0, w3 62 | ;w3:w2 = 2^-32 * induct_scale * imag_impedance * phi_int_max_display * inv_vbat0 63 | ;w3:w2 = xxxx xxxx xUUU UUUU : UUUU UUUU Uyyy yyyy 64 | sl w3, #9, w3 65 | lsr w2, #7, w2 66 | ior w3, w2, w3 67 | ;w3 = 2^-39 * induct_scale * imag_impedance * phi_int_max_display * inv_vbat0 68 | mov w3, mfa_x 69 | 70 | return 71 | 72 | ;***************************************************************** 73 | ;* 74 | ;***************************************************************** 75 | .end 76 | 77 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/fill_pwm_and_sin_arrays.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global fill_pwm_and_sin_arrays 9 | fill_pwm_and_sin_arrays: 10 | ;-------------------------------------- fill both arrays with sin(x) 11 | 12 | mov #data_array_sin+2, w10 ;address for 0-90 degrees 13 | mov #data_array_sin+254, w11 ;address for 180-90 degrees 14 | mov #data_array_sin+258, w12 ;address for 180-270 degrees 15 | mov #data_array_sin+510, w13 ;address for 360-270 degrees 16 | 17 | ;set 0 and 180 degrees to 0 18 | clr data_array_sin 19 | clr data_array_sin+256 20 | ;set 90 degrees to 32767 21 | mov #32767, w0 22 | mov w0, data_array_sin+128 23 | ;set 270 degrees to -32767 24 | mov #-32767, w0 25 | mov w0, data_array_sin+384 26 | ;-------------------------------------- initialise ROM table read 27 | mov #tblpage(sine_table), w9 28 | mov w9, TBLPAG 29 | mov #tbloffset(sine_table), w9 30 | 31 | ;-------------------------------------- loop and fill RAM table 32 | do #62, fill_lp 33 | 34 | tblrdl [w9], w0 35 | 36 | add #4, w9 37 | 38 | mov w0, [w10++] 39 | mov w0, [w11--] 40 | neg w0, w0 41 | mov w0, [w12++] 42 | fill_lp: 43 | mov w0, [w13--] 44 | ;-------------------------------------- end 45 | 46 | return 47 | 48 | ;***************************************************************** 49 | 50 | .align 2 51 | sine_table: 52 | .word 804, ;1-7 53 | .word 1608, 54 | .word 2410, 55 | .word 3212, 56 | .word 4011, 57 | .word 4808, 58 | .word 5602, 59 | 60 | .word 6393, ;8-15 61 | .word 7179, 62 | .word 7962, 63 | .word 8739, 64 | .word 9512, 65 | .word 10278, 66 | .word 11039, 67 | .word 11793, 68 | 69 | .word 12539, ;16-23 70 | .word 13279, 71 | .word 14010, 72 | .word 14732, 73 | .word 15446, 74 | .word 16151, 75 | .word 16846, 76 | .word 17530, 77 | 78 | .word 18204, ;24-31 79 | .word 18868, 80 | .word 19519, 81 | .word 20159, 82 | .word 20787, 83 | .word 21403, 84 | .word 22005, 85 | .word 22594, 86 | 87 | .word 23170, ;32-39 88 | .word 23731, 89 | .word 24279, 90 | .word 24811, 91 | .word 25329, 92 | .word 25832, 93 | .word 26319, 94 | .word 26790, 95 | 96 | .word 27245, ;40-47 97 | .word 27683, 98 | .word 28105, 99 | .word 28510, 100 | .word 28898, 101 | .word 29268, 102 | .word 29621, 103 | .word 29956, 104 | 105 | .word 30273, ;48-55 106 | .word 30571, 107 | .word 30852, 108 | .word 31113, 109 | .word 31356, 110 | .word 31580, 111 | .word 31785, 112 | .word 31971, 113 | 114 | .word 32137, ;56-63 115 | .word 32285, 116 | .word 32412, 117 | .word 32521, 118 | .word 32609, 119 | .word 32678, 120 | .word 32728, 121 | .word 32757, 122 | 123 | 124 | 125 | 126 | 127 | 128 | .end 129 | 130 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/filter_4th_order.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global filter_4th_order 9 | ; w1: input, signed, -25000 .. 25000 10 | ; w11: start of integrator array 11 | ; output in [w11+12] 12 | filter_4th_order: 13 | ;w11 points to int_1, MSW, LSW 14 | add w11, #4, w12 ;w12 points to int_2, MSW, LSW 15 | add w11, #8, w13 ;w13 points to int_3, MSW, LSW 16 | add w11, #12, w14 ;w14 points to int_4, MSW, LSW 17 | 18 | ;---------------------------------------------- mult input with coef1, add to 1st integrator 19 | ;w1: input 20 | mov #556, w2 ;0.00849 for 100Hz at 40kHz fs 21 | mul.us w2, w1, w0 22 | add w0, [++w11], [w11] 23 | addc w1, [--w11], [w11] 24 | 25 | ;---------------------------------------------- mult int_2 with coef1, sub from 1st integrator 26 | 27 | mul.us w2, [w12], w0 28 | subr w0, [++w11], [w11] 29 | subbr w1, [--w11], [w11] 30 | 31 | ;---------------------------------------------- mult int_2 with coef2, sub from 2nd integrator 32 | 33 | mov #1901, w2 ;0.02901 for 100Hz at 40kHz fs 34 | mul.us w2, [w12], w0 35 | subr w0, [++w12], [w12] 36 | subbr w1, [--w12], [w12] 37 | 38 | ;---------------------------------------------- mult int_1 with coef2, add to 2nd integrator 39 | 40 | mul.us w2, [w11], w0 41 | add w0, [++w12], [w12] 42 | addc w1, [--w12], [w12] 43 | 44 | ;---------------------------------------------- mult int_2 with coef3, add to 3rd integrator 45 | 46 | mov #1343, w2 ;0.0205 for 100Hz at 40kHz fs 47 | mul.us w2, [w12], w0 48 | add w0, [++w13], [w13] 49 | addc w1, [--w13], [w13] 50 | 51 | ;---------------------------------------------- mult int_4 with coef3, sub from 3rd integrator 52 | 53 | mul.us w2, [w14], w0 54 | subr w0, [++w13], [w13] 55 | subbr w1, [--w13], [w13] 56 | 57 | ;---------------------------------------------- mult int_4 with coef4, sub from 4th integrator 58 | 59 | mov #786, w2 ;0.012 for 100Hz at 40kHz fs 60 | mul.us w2, [w14], w0 61 | subr w0, [++w14], [w14] 62 | subbr w1, [--w14], [w14] 63 | 64 | ;---------------------------------------------- mult int_3 with coef4, add to 4th integrator 65 | 66 | mul.us w2, [w13], w0 67 | add w0, [++w14], [w14] 68 | addc w1, [--w14], [w14] 69 | 70 | ;---------------------------------------------- end 71 | return 72 | 73 | 74 | .end 75 | 76 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/fp_macros.mac: -------------------------------------------------------------------------------- 1 | ;************************************************************************************ 2 | 3 | .macro unsigned_to_fp source destination 4 | 5 | lsr \source, wreg 6 | fbcl w0, w3 7 | mov w3, \destination 8 | inc \destination 9 | neg w3, w3 10 | sl w0, w3, w0 11 | mov w0, \destination+2 12 | 13 | .endm 14 | 15 | ;************************************************************************************ 16 | 17 | .macro signed_to_fp source destination 18 | 19 | mov \source, w0 20 | fbcl w0, w3 21 | mov w3, \destination 22 | neg w3, w3 23 | sl w0, w3, w0 24 | mov w0, \destination+2 25 | 26 | .endm 27 | 28 | ;************************************************************************************ 29 | 30 | 31 | .macro signed32_to_fp source destination 32 | 33 | mov \source, w3 34 | mov \source+2, w2 35 | fbcl w3, w0 36 | mov w0, \destination 37 | neg w0, w0 38 | sl w3, w0, w3 39 | subr w0, #16, w0 40 | lsr w2, w0, w2 41 | ior w3, w2, w3 42 | mov w3, \destination+2 43 | 44 | .endm 45 | 46 | ;************************************************************************************ 47 | 48 | .macro signed_w0_to_fp destination 49 | 50 | fbcl w0, w3 51 | mov w3, \destination 52 | neg w3, w3 53 | sl w0, w3, w0 54 | mov w0, \destination+2 55 | 56 | .endm 57 | 58 | ;************************************************************************************ 59 | 60 | 61 | .macro signed32_w3w2_to_fp destination 62 | 63 | fbcl w3, w0 64 | mov w0, \destination 65 | neg w0, w0 66 | sl w3, w0, w3 67 | subr w0, #16, w0 68 | lsr w2, w0, w2 69 | ior w3, w2, w3 70 | mov w3, \destination+2 71 | 72 | .endm 73 | 74 | ;************************************************************************************ 75 | 76 | .macro reg_copy 77 | mov [w12++], [w13++] 78 | mov [w12--], [w13--] 79 | .endm 80 | 81 | ;************************************************************************************ 82 | 83 | .macro fp_to_int source destination 84 | 85 | neg \source, wreg 86 | mov \source+2, \destination 87 | asr \destination, w0, \destination 88 | ;overflow if w0 negative 89 | btss w0, #15 90 | bra 9f 91 | ;max out \destination 92 | mov #0x7FFF, \destination 93 | btsc \source+2, #15 94 | mov #0x8001, \destination 95 | 9: 96 | 97 | .endm 98 | 99 | ;************************************************************************************ 100 | 101 | 102 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/get_inductor_measurement_amplitude.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global get_inductor_measurement_amplitude 9 | 10 | ;determines the ampli_real for a certain amount 11 | ;of current (wanted_i_real) through the motor. 12 | 13 | get_inductor_measurement_amplitude: 14 | 15 | ;--------------------------------------- initialise 16 | ;switch ADCs over to current measurement, wait a bit before 1st measurement 17 | call ADC_current 18 | repeat #5 19 | nop 20 | ;start first current measurement 21 | bclr ADCON1, #1 22 | 23 | mov inductor_amplitude_measurement_count, w0 24 | 25 | ;--------------------------------------- execute measurement 26 | 27 | gima_lp: 28 | ;wait for next iteration 29 | btss IFS0, #3 30 | bra gima_lp 31 | bclr IFS0, #3 32 | 33 | push w0 34 | ;get current measurements 35 | call ADC_read_current 36 | ;start new current measurement 37 | bclr ADCON1, #1 38 | ;disect currents 39 | call disect_current 40 | ;update amplitude 41 | call i_real_control 42 | ;negate i_imag to lock motor 43 | neg i_imag 44 | 45 | ;--------------------------------------- update phi and loopfilter 46 | 47 | mov #plic+4, w12 ;positive array position, only need 1st order coefficients 48 | btsc i_imag, #15 49 | add w12, #8, w12 ;shift to negative if i_imag < 0 50 | 51 | mov [w12++], w5 ;w5.w6 to be added to phi (this is the 1st integrator bypass path) 52 | mov [w12], w6 53 | 54 | mov #phi+2, w1 55 | ;add to phi 56 | add w6, [w1], [w1--] 57 | addc w5, [w1], [w1] 58 | 59 | ;--------------------------------------- output sine waves 60 | 61 | call write_motor_sinus 62 | ;loop 63 | pop w0 64 | dec w0, w0 65 | bra nz, gima_lp 66 | 67 | ;---------------------------------------------- end 68 | 69 | return 70 | 71 | ;***************************************************************** 72 | 73 | 74 | 75 | 76 | 77 | .end 78 | 79 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/halls.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | .include "macros.mac" 4 | 5 | .text 6 | .global halls_open 7 | halls_open: 8 | ;---------------------------------------------- initialise pins to digital input 9 | ;hall 1, MSB 10 | bset TRISF, #2 11 | ;hall 2 12 | bset TRISF, #3 13 | ;hall 3, LSB 14 | bset TRISD, #0 15 | 16 | return 17 | 18 | ;******************************************* 19 | 20 | .global update_hall_positions 21 | update_hall_positions: 22 | ;---------------------------------------------- convert motor phase to X (=0.5*cos phi_motor) and Y (=0.5*sin phi_motor) 23 | ;position in sine array 24 | mov phi_motor, w0 25 | lsr w0, #7, w13 26 | bclr w13, #0 27 | bset w13, #11 28 | ;0.5*[w13] to Y (the 0.5 prevents overshoot - out of range issues in the 2nd order filter 29 | asr [w13], w9 30 | ;move to cosine 31 | add #128, w13 32 | bclr w13, #9 33 | ;0.5*[w13] to X 34 | asr [w13], w8 35 | 36 | ;---------------------------------------------- sample hall states and calculate filter_hallXY array offset 37 | ;determine hall code (times 4) 38 | clr w10 39 | btsc PORTF, #2 40 | bset w10, #4 41 | btsc PORTF, #3 42 | bset w10, #3 43 | btsc PORTD, #0 44 | bset w10, #2 45 | 46 | ;---------------------------------------------- process filter X 47 | 48 | mov #filter_hallX, w13 49 | add w13, w10, w13 50 | mov filter_general_coeff, w11 51 | filter w8 52 | 53 | ;---------------------------------------------- process filter Y 54 | 55 | mov #filter_hallY, w13 56 | add w13, w10, w13 57 | filter w9 58 | 59 | ;---------------------------------------------- end 60 | 61 | return 62 | 63 | ;******************************************* 64 | 65 | .global build_hall_array 66 | build_hall_array: 67 | 68 | ;---------------------------------------------- initialise 69 | mov #filter_hallX, w8 70 | mov #filter_hallY, w9 71 | mov #hall_array, w10 72 | mov #8, w11 73 | ;---------------------------------------------- loop 8 times 74 | bha_loop: 75 | ;---------------------------------------------- get X,Y value 76 | push w8 77 | push w9 78 | mov [w8], w8 79 | mov [w9], w9 80 | ;---------------------------------------------- convert to angle, amplitude 81 | push w10 82 | 83 | call angle_amplitude_accurate 84 | 85 | pop w10 86 | ;---------------------------------------------- build hall word 87 | ;keep top 8 bits phase info 88 | mov #0xFF00, w0 89 | and w9, w0, w9 90 | ;shift ampli bits down by 8 and or into w9 91 | lsr w8, #8, w8 92 | ior w9, w8, w9 93 | ;set use bit if ampli larger than 33% (keep also 0.5 XY scaling factor in mind) 94 | bclr w9, #0 95 | mov #21, w0 96 | cpslt w8, w0 97 | bset w9, #0 98 | 99 | ;---------------------------------------------- store and repeat 100 | 101 | mov w9, [w10++] 102 | ;recover array positions and increase 103 | pop w9 104 | add #4, w9 105 | pop w8 106 | add #4, w8 107 | 108 | dec w11, w11 109 | bra nz, bha_loop 110 | 111 | ;---------------------------------------------- end 112 | 113 | return 114 | 115 | ;******************************************* 116 | 117 | 118 | .end 119 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/init_interrupts.s: -------------------------------------------------------------------------------- 1 | .text 2 | 3 | .global init_interrupts 4 | ;initialise interrupts 5 | 6 | init_interrupts: 7 | ;turn off all interrupts by disabling them 8 | clr IEC0 9 | clr IEC1 10 | clr IEC2 11 | ;no CAN interrupts 12 | clr C1INTE 13 | ;set all interrupts to level 0 14 | clr IPC0 15 | clr IPC1 16 | clr IPC2 17 | clr IPC3 18 | clr IPC4 19 | clr IPC5 20 | clr IPC6 21 | clr IPC9 22 | clr IPC10 23 | ;interrupt nesting allowed 24 | bclr INTCON1, #15 25 | ;use default IVT 26 | bclr INTCON2, #15 27 | ;set processor interrupt level 1 or higher 28 | bclr CORCON, #3 29 | bclr SR, #7 30 | bclr SR, #6 31 | bclr SR, #5 32 | 33 | return 34 | 35 | .end 36 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/inverse_vbat.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global inverse_vbat 9 | ; 10 | ;corrupted variables 11 | ; w0, w1, w2, w3 12 | ; 13 | ;filter_inv_vbat = (512*65536 / battery adc reading) 14 | inverse_vbat: 15 | ;--------------------------------------- get supply, force in-range [512..1023] 16 | mov supply_voltage, w0 17 | btss w0, #9 18 | mov #513, w0 19 | ;--------------------------------------- calc loop filter input 20 | mul filter_inv_vbat 21 | mov #512, w0 22 | sub w0, w3, w0 23 | ;--------------------------------------- update integrator 1 24 | add filter_inv_vbat+2 25 | ;--------------------------------------- calc value to be added to output integrator 26 | sl w0, w1 27 | mov filter_inv_vbat+2, w0 28 | asr w0, #6, w0 29 | add w1, w0, w0 30 | ;--------------------------------------- add to output integrator but stay in range ! 31 | add filter_inv_vbat 32 | ;no problem if w0 is negative, end 33 | btsc w0, #15 34 | return 35 | ;clip if carry after add 36 | btsc SR, #C 37 | setm filter_inv_vbat 38 | ;--------------------------------------- end 39 | return 40 | 41 | .end 42 | 43 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/macros.mac: -------------------------------------------------------------------------------- 1 | ;************************************************************************************ 2 | 3 | .macro filter reg 4 | ;difference 5 | sub \reg, [w13], w0 6 | ;mult with coeff 7 | mul.us w11, w0, w0 8 | ;add to output 9 | add w0, [++w13], [w13] 10 | addc w1, [--w13], [w13] 11 | 12 | .endm 13 | 14 | ;************************************************************************************ 15 | 16 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/main_motor.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main_motor 9 | main_motor: 10 | ;---------------------------------------------- set motoring bit 11 | bset flags1, #motor_mode 12 | ;---------------------------------------------- initialise 13 | call initialise 14 | ;---------------------------------------------- start with drive_0 15 | goto initialise_drive_0_all 16 | 17 | ;***************************************************************** 18 | 19 | .end 20 | 21 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/draft menu structure: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | auto: 7 | phase 0,1,2nd order 8 | amp 0,1st order 9 | max amplitude 10 | 11 | 12 | filter menu 13 | auto 14 | 15 | motor measure menu 16 | -gain and offset calibration 17 | -current,rpm for FOC measurement 18 | 19 | can menu 20 | 21 | rom menu 22 | 23 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/draft menu structure~: -------------------------------------------------------------------------------- 1 | 2 | current sensor transimpedance 3 | phase current 4 | battery current 5 | battery current regen 6 | fix motor position current 7 | restore sensor calibration 8 | 9 | auto: 10 | error current 11 | error current prop 12 | hf current prop 13 | 14 | 15 | sample frequency 16 | rpm 2to3 17 | rpm 3to2 18 | max rpm 19 | 20 | auto: 21 | phase 0,1,2nd order 22 | amp 0,1st order 23 | max amplitude 24 | 25 | 26 | filter menu 27 | auto 28 | 29 | motor measure menu 30 | -gain and offset calibration 31 | -current,rpm for FOC measurement 32 | 33 | can menu 34 | 35 | rom menu 36 | 37 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/menu_can.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global menu_can 6 | menu_can: 7 | call clr_scr_232 8 | 9 | mov #tblpage(menu_can_msg), w0 10 | mov #tbloffset(menu_can_msg), w1 11 | call tx_str_232 12 | ;can address 13 | mov can_rxsid, w0 14 | lsr w0, #2, w0 15 | mov #str_buf, w1 16 | call word_to_udec_str 17 | mov #str_buf, w0 18 | call tx_ram_str_232 19 | 20 | mov #tblpage(menu_can_cont1), w0 21 | mov #tbloffset(menu_can_cont1), w1 22 | call tx_str_232 23 | ;cfg1 24 | mov can_cfg1, w0 25 | mov #str_buf, w1 26 | call word_to_udec_str 27 | mov #str_buf, w0 28 | call tx_ram_str_232 29 | 30 | mov #tblpage(menu_can_cont2), w0 31 | mov #tbloffset(menu_can_cont2), w1 32 | call tx_str_232 33 | ;cfg2 34 | mov can_cfg2, w0 35 | mov #str_buf, w1 36 | call word_to_udec_str 37 | mov #str_buf, w0 38 | call tx_ram_str_232 39 | 40 | mov #tblpage(menu_can_cont3), w0 41 | mov #tbloffset(menu_can_cont3), w1 42 | call tx_str_232 43 | ;rs232 rate = 30e6 / (main_loop_count * monitoring_value) 44 | mov main_loop_count, w0 45 | mov monitoring_value, w1 46 | mul.uu w0, w1, w0 47 | mov w0, w2 48 | mov #457, w1 49 | mov #50048, w0 50 | repeat #17 51 | div.ud w0, w2 52 | mov #str_buf, w1 53 | call word_to_udec_str 54 | mov #str_buf, w0 55 | call tx_ram_str_232 56 | 57 | mov #tblpage(menu_can_cont4), w0 58 | mov #tbloffset(menu_can_cont4), w1 59 | call tx_str_232 60 | 61 | call get_choise 62 | 63 | mov #'a', w1 64 | cp w0, w1 65 | bra z, mcan_opt_a 66 | mov #'b', w1 67 | cp w0, w1 68 | bra z, mcan_opt_b 69 | mov #'c', w1 70 | cp w0, w1 71 | bra z, mcan_opt_c 72 | mov #'z', w1 73 | cp w0, w1 74 | bra z, mcan_opt_z 75 | 76 | bra menu_can 77 | 78 | ;------------------------------------------------------ 79 | 80 | mcan_opt_a: 81 | 82 | mov #4, w0 83 | call get_number 84 | 85 | mov #2047, w1 86 | cpslt w0, w1 87 | bra menu_can 88 | 89 | sl w0, #2, w1 90 | mov w1, can_rxsid 91 | 92 | mov #0x00FF, w2 93 | and w1, w2, w1 94 | sl w0, #5, w0 95 | mov #0xF800, w2 96 | and w0, w2, w0 97 | ior w0, w1, w0 98 | 99 | mov w0, can_txsid 100 | 101 | bra menu_can 102 | 103 | ;------------------------------------------------------ 104 | 105 | mcan_opt_b: 106 | mov #5, w0 107 | call get_number 108 | 109 | mov w0, can_cfg1 110 | 111 | bra menu_can 112 | 113 | ;------------------------------------------------------ 114 | 115 | mcan_opt_c: 116 | mov #5, w0 117 | call get_number 118 | 119 | mov w0, can_cfg2 120 | 121 | bra menu_can 122 | 123 | ;------------------------------------------------------ 124 | 125 | mcan_opt_z: 126 | return 127 | 128 | ;********************************************************** 129 | 130 | menu_can_msg: 131 | .pascii "\na) CAN 'address': \0" 132 | menu_can_cont1: 133 | .pascii "\nb) CAN CFG1 as per Microchip 30F manual: \0" 134 | menu_can_cont2: 135 | .pascii "\nc) CAN CFG2 as per Microchip 30F manual: \0" 136 | menu_can_cont3: 137 | .pascii"\n RS232 output rate: \0" 138 | menu_can_cont4: 139 | .pascii " Hz\nz) return to main menu" 140 | .pascii "\n\n\0" 141 | .end 142 | 143 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/menu_loop_coeffs.s~: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global menu_battery 6 | menu_battery: 7 | call clr_scr_232 8 | ;------------------------------------------------------ 9 | ;a) battery voltage 10 | ;------------------------------------------------------ 11 | mov #tblpage(bat_mes_a), w0 12 | mov #tbloffset(bat_mes_a), w1 13 | call tx_str_232 14 | 15 | mov battery_voltage, w0 16 | lsr w0, #4, w0 17 | mov #str_buf, w1 18 | call word_to_udec_str 19 | mov #str_buf, w0 20 | call tx_ram_str_232 21 | 22 | mov battery_voltage, w0 23 | sl w0, #12, w0 24 | mov #str_buf, w1 25 | call word_to_01_str 26 | clr.b str_buf+2 27 | mov #str_buf, w0 28 | call tx_ram_str_232 29 | 30 | mov #tblpage(bat_mes_a1), w0 31 | mov #tbloffset(bat_mes_a1), w1 32 | call tx_str_232 33 | 34 | bra mb_msg_z 35 | 36 | mb_opt_a: 37 | 38 | mov #10, w0 39 | call get_signed_decimal_number 40 | 41 | sl w0, #4, w0 42 | lsr w1, #12, w1 43 | ior w0, w1, w0 44 | 45 | mov w0, battery_voltage 46 | 47 | bra menu_battery 48 | 49 | ;------------------------------------------------------ 50 | ;z) return to main menu 51 | ;------------------------------------------------------ 52 | mb_msg_z: 53 | mov #tblpage(bat_mes_z), w0 54 | mov #tbloffset(bat_mes_z), w1 55 | call tx_str_232 56 | 57 | bra mb_msg_choise 58 | mb_opt_z: 59 | return 60 | 61 | ;------------------------------------------------------ 62 | mb_msg_choise: 63 | 64 | call get_choise 65 | 66 | mov #'a', w1 67 | cp w0, w1 68 | bra z, mb_opt_a 69 | mov #'z', w1 70 | cp w0, w1 71 | bra z, mb_opt_z 72 | 73 | bra menu_battery 74 | 75 | ;********************************************************** 76 | 77 | bat_mes_a: 78 | .ascii "\na) battery voltage: \0" 79 | bat_mes_a1: 80 | .ascii " V\0" 81 | bat_mes_z: 82 | .ascii "\n\nz) return to main menu" 83 | .ascii "\n\n\0" 84 | 85 | 86 | 87 | .end 88 | 89 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/menu_recov.s~: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global menu_battery 6 | menu_battery: 7 | call clr_scr_232 8 | ;------------------------------------------------------ 9 | ;a) battery voltage 10 | ;------------------------------------------------------ 11 | mov #tblpage(bat_mes_a), w0 12 | mov #tbloffset(bat_mes_a), w1 13 | call tx_str_232 14 | 15 | mov battery_voltage, w0 16 | lsr w0, #4, w0 17 | mov #str_buf, w1 18 | call word_to_udec_str 19 | mov #str_buf, w0 20 | call tx_ram_str_232 21 | 22 | mov battery_voltage, w0 23 | sl w0, #12, w0 24 | mov #str_buf, w1 25 | call word_to_01_str 26 | clr.b str_buf+2 27 | mov #str_buf, w0 28 | call tx_ram_str_232 29 | 30 | mov #tblpage(bat_mes_a1), w0 31 | mov #tbloffset(bat_mes_a1), w1 32 | call tx_str_232 33 | 34 | bra mb_msg_z 35 | 36 | mb_opt_a: 37 | 38 | mov #10, w0 39 | call get_signed_decimal_number 40 | 41 | sl w0, #4, w0 42 | lsr w1, #12, w1 43 | ior w0, w1, w0 44 | 45 | mov w0, battery_voltage 46 | 47 | bra menu_battery 48 | 49 | ;------------------------------------------------------ 50 | ;z) return to main menu 51 | ;------------------------------------------------------ 52 | mb_msg_z: 53 | mov #tblpage(bat_mes_z), w0 54 | mov #tbloffset(bat_mes_z), w1 55 | call tx_str_232 56 | 57 | bra mb_msg_choise 58 | mb_opt_z: 59 | return 60 | 61 | ;------------------------------------------------------ 62 | mb_msg_choise: 63 | 64 | call get_choise 65 | 66 | mov #'a', w1 67 | cp w0, w1 68 | bra z, mb_opt_a 69 | mov #'z', w1 70 | cp w0, w1 71 | bra z, mb_opt_z 72 | 73 | bra menu_battery 74 | 75 | ;********************************************************** 76 | 77 | bat_mes_a: 78 | .ascii "\na) battery voltage: \0" 79 | bat_mes_a1: 80 | .ascii " V\0" 81 | bat_mes_z: 82 | .ascii "\n\nz) return to main menu" 83 | .ascii "\n\n\0" 84 | 85 | 86 | 87 | .end 88 | 89 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/menu_rom.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global menu_rom 6 | menu_rom: 7 | ;------------------------------------------------------ 8 | ;a) save data to ROM for motor use 9 | ;------------------------------------------------------ 10 | mov #tblpage(rom_mes_a), w0 11 | mov #tbloffset(rom_mes_a), w1 12 | call tx_str_232 13 | 14 | bra mr_msg_b 15 | 16 | mr_opt_a: 17 | call store_in_progmem 18 | 19 | bra menu_rom 20 | 21 | ;------------------------------------------------------ 22 | ;b) print data in HEX format 23 | ;------------------------------------------------------ 24 | mr_msg_b: 25 | mov #tblpage(rom_mes_b), w0 26 | mov #tbloffset(rom_mes_b), w1 27 | call tx_str_232 28 | 29 | bra mr_msg_c 30 | 31 | mr_opt_b: 32 | mov #tblpage(rom_mes_b1), w0 33 | mov #tbloffset(rom_mes_b1), w1 34 | call tx_str_232 35 | 36 | call store_in_ascii 37 | 38 | bra menu_rom 39 | 40 | ;------------------------------------------------------ 41 | ;c) enter data in HEX format 42 | ;------------------------------------------------------ 43 | mr_msg_c: 44 | mov #tblpage(rom_mes_c), w0 45 | mov #tbloffset(rom_mes_c), w1 46 | call tx_str_232 47 | 48 | bra mr_msg_d 49 | 50 | mr_opt_c: 51 | 52 | call restore_from_ascii 53 | 54 | bra menu_rom 55 | 56 | ;------------------------------------------------------ 57 | ;d) online parameter save: 58 | ;------------------------------------------------------ 59 | mr_msg_d: 60 | mov #tblpage(rom_mes_d), w0 61 | mov #tbloffset(rom_mes_d), w1 62 | call tx_str_232 63 | 64 | mov #tblpage(rom_mes_en), w0 65 | mov #tbloffset(rom_mes_en), w1 66 | btss flags_rom, #allow_rom_write 67 | mov #tblpage(rom_mes_dis), w0 68 | btss flags_rom, #allow_rom_write 69 | mov #tbloffset(rom_mes_dis), w1 70 | call tx_str_232 71 | 72 | bra mr_msg_z 73 | 74 | mr_opt_d: 75 | btg flags_rom, #allow_rom_write 76 | 77 | bra menu_rom 78 | 79 | ;------------------------------------------------------ 80 | ;z) return to main menu 81 | ;------------------------------------------------------ 82 | mr_msg_z: 83 | mov #tblpage(rom_mes_z), w0 84 | mov #tbloffset(rom_mes_z), w1 85 | call tx_str_232 86 | 87 | bra mr_msg_choise 88 | mr_opt_z: 89 | return 90 | 91 | ;------------------------------------------------------ 92 | mr_msg_choise: 93 | 94 | call get_choise 95 | 96 | mov #'a', w1 97 | cp w0, w1 98 | bra z, mr_opt_a 99 | mov #'b', w1 100 | cp w0, w1 101 | bra z, mr_opt_b 102 | mov #'c', w1 103 | cp w0, w1 104 | bra z, mr_opt_c 105 | mov #'d', w1 106 | cp w0, w1 107 | bra z, mr_opt_d 108 | mov #'z', w1 109 | cp w0, w1 110 | bra z, mr_opt_z 111 | 112 | bra menu_rom 113 | 114 | ;********************************************************** 115 | 116 | rom_mes_a: 117 | .pascii "\na) save data to ROM for motor use\0" 118 | rom_mes_b: 119 | .pascii "\nb) print data in HEX format\0" 120 | rom_mes_b1: 121 | .pascii "\n save the following HEX lines in a text file, including the '*' termination character\n\n\0" 122 | rom_mes_c: 123 | .pascii "\nc) enter data in HEX format\0" 124 | rom_mes_d: 125 | .pascii "\nd) online parameter save: \0" 126 | rom_mes_z: 127 | .pascii "\n\nz) return to main menu" 128 | .pascii "\n\n\0" 129 | rom_mes_en: 130 | .pascii "enabled\0" 131 | rom_mes_dis: 132 | .pascii "disabled\0" 133 | 134 | 135 | 136 | .end 137 | 138 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/menu_rom.s~: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global menu_battery 6 | menu_battery: 7 | call clr_scr_232 8 | ;------------------------------------------------------ 9 | ;a) battery voltage 10 | ;------------------------------------------------------ 11 | mov #tblpage(bat_mes_a), w0 12 | mov #tbloffset(bat_mes_a), w1 13 | call tx_str_232 14 | 15 | mov battery_voltage, w0 16 | lsr w0, #4, w0 17 | mov #str_buf, w1 18 | call word_to_udec_str 19 | mov #str_buf, w0 20 | call tx_ram_str_232 21 | 22 | mov battery_voltage, w0 23 | sl w0, #12, w0 24 | mov #str_buf, w1 25 | call word_to_01_str 26 | clr.b str_buf+2 27 | mov #str_buf, w0 28 | call tx_ram_str_232 29 | 30 | mov #tblpage(bat_mes_a1), w0 31 | mov #tbloffset(bat_mes_a1), w1 32 | call tx_str_232 33 | 34 | bra mb_msg_z 35 | 36 | mb_opt_a: 37 | 38 | mov #10, w0 39 | call get_signed_decimal_number 40 | 41 | sl w0, #4, w0 42 | lsr w1, #12, w1 43 | ior w0, w1, w0 44 | 45 | mov w0, battery_voltage 46 | 47 | bra menu_battery 48 | 49 | ;------------------------------------------------------ 50 | ;z) return to main menu 51 | ;------------------------------------------------------ 52 | mb_msg_z: 53 | mov #tblpage(bat_mes_z), w0 54 | mov #tbloffset(bat_mes_z), w1 55 | call tx_str_232 56 | 57 | bra mb_msg_choise 58 | mb_opt_z: 59 | return 60 | 61 | ;------------------------------------------------------ 62 | mb_msg_choise: 63 | 64 | call get_choise 65 | 66 | mov #'a', w1 67 | cp w0, w1 68 | bra z, mb_opt_a 69 | mov #'z', w1 70 | cp w0, w1 71 | bra z, mb_opt_z 72 | 73 | bra menu_battery 74 | 75 | ;********************************************************** 76 | 77 | bat_mes_a: 78 | .ascii "\na) battery voltage: \0" 79 | bat_mes_a1: 80 | .ascii " V\0" 81 | bat_mes_z: 82 | .ascii "\n\nz) return to main menu" 83 | .ascii "\n\n\0" 84 | 85 | 86 | 87 | .end 88 | 89 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/menu_stored_status.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | .global menu_stored_status 7 | menu_stored_status: 8 | menu_start: 9 | call clr_scr_232 10 | 11 | mov #tblpage(lastbut3), w0 12 | mov #tbloffset(lastbut3), w1 13 | call tx_str_232 14 | 15 | mov #stored_status+108, w13 16 | call print_status 17 | 18 | mov #tblpage(lastbut2), w0 19 | mov #tbloffset(lastbut2), w1 20 | call tx_str_232 21 | 22 | mov #stored_status+72, w13 23 | call print_status 24 | 25 | mov #tblpage(lastbut1), w0 26 | mov #tbloffset(lastbut1), w1 27 | call tx_str_232 28 | 29 | mov #stored_status+36, w13 30 | call print_status 31 | 32 | mov #tblpage(lastbut0), w0 33 | mov #tbloffset(lastbut0), w1 34 | call tx_str_232 35 | 36 | mov #stored_status+0, w13 37 | call print_status 38 | 39 | ;------------------------------------------------------ 40 | ;z) clear_all 41 | ;------------------------------------------------------ 42 | msg_a: 43 | mov #tblpage(mes_a), w0 44 | mov #tbloffset(mes_a), w1 45 | call tx_str_232 46 | 47 | bra msg_z 48 | opt_a: 49 | 50 | mov #stored_status, w13 51 | ; mov #1000, w10 52 | 53 | repeat #63 54 | clr [w13++] 55 | 56 | bra menu_start 57 | 58 | ;------------------------------------------------------ 59 | ;z) return to main menu 60 | ;------------------------------------------------------ 61 | msg_z: 62 | mov #tblpage(mes_z), w0 63 | mov #tbloffset(mes_z), w1 64 | call tx_str_232 65 | 66 | bra msg_choise 67 | opt_z: 68 | return 69 | 70 | ;------------------------------------------------------ 71 | msg_choise: 72 | 73 | call get_choise 74 | 75 | mov #'a', w1 76 | cp w0, w1 77 | bra z, opt_a 78 | mov #'z', w1 79 | cp w0, w1 80 | bra z, opt_z 81 | 82 | bra menu_start 83 | 84 | ;********************************************************** 85 | 86 | lastbut3: 87 | .pascii "\n\n\n Last but 2 entry into drive_1:\n\0" 88 | lastbut2: 89 | .pascii "\n\n\n Last but 1 entry into drive_1:\n\0" 90 | lastbut1: 91 | .pascii "\n\n\n Last entry into drive_1:\n\0" 92 | lastbut0: 93 | .pascii "\n\n\n Chip status at button press:\n\0" 94 | mes_a: 95 | .pascii "\n\n\na) clear all\0" 96 | mes_z: 97 | .pascii "\n\nz) return to main menu" 98 | .pascii "\n\n\0" 99 | 100 | 101 | 102 | .end 103 | 104 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/menu_stored_status.s~: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global menu_battery 6 | menu_battery: 7 | call clr_scr_232 8 | ;------------------------------------------------------ 9 | ;a) battery voltage 10 | ;------------------------------------------------------ 11 | mov #tblpage(bat_mes_a), w0 12 | mov #tbloffset(bat_mes_a), w1 13 | call tx_str_232 14 | 15 | mov battery_voltage, w0 16 | lsr w0, #4, w0 17 | mov #str_buf, w1 18 | call word_to_udec_str 19 | mov #str_buf, w0 20 | call tx_ram_str_232 21 | 22 | mov battery_voltage, w0 23 | sl w0, #12, w0 24 | mov #str_buf, w1 25 | call word_to_01_str 26 | clr.b str_buf+2 27 | mov #str_buf, w0 28 | call tx_ram_str_232 29 | 30 | mov #tblpage(bat_mes_a1), w0 31 | mov #tbloffset(bat_mes_a1), w1 32 | call tx_str_232 33 | 34 | bra mb_msg_z 35 | 36 | mb_opt_a: 37 | 38 | mov #10, w0 39 | call get_signed_decimal_number 40 | 41 | sl w0, #4, w0 42 | lsr w1, #12, w1 43 | ior w0, w1, w0 44 | 45 | mov w0, battery_voltage 46 | 47 | bra menu_battery 48 | 49 | ;------------------------------------------------------ 50 | ;z) return to main menu 51 | ;------------------------------------------------------ 52 | mb_msg_z: 53 | mov #tblpage(bat_mes_z), w0 54 | mov #tbloffset(bat_mes_z), w1 55 | call tx_str_232 56 | 57 | bra mb_msg_choise 58 | mb_opt_z: 59 | return 60 | 61 | ;------------------------------------------------------ 62 | mb_msg_choise: 63 | 64 | call get_choise 65 | 66 | mov #'a', w1 67 | cp w0, w1 68 | bra z, mb_opt_a 69 | mov #'z', w1 70 | cp w0, w1 71 | bra z, mb_opt_z 72 | 73 | bra menu_battery 74 | 75 | ;********************************************************** 76 | 77 | bat_mes_a: 78 | .ascii "\na) battery voltage: \0" 79 | bat_mes_a1: 80 | .ascii " V\0" 81 | bat_mes_z: 82 | .ascii "\n\nz) return to main menu" 83 | .ascii "\n\n\0" 84 | 85 | 86 | 87 | .end 88 | 89 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/menu_temp.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | .include "temp_macros.s" 4 | 5 | .text 6 | .global menu_temp 7 | menu_temp: 8 | call clr_scr_232 9 | ;------------------------------------------------------ 10 | ;a) use temp sensors: 11 | ;------------------------------------------------------ 12 | mov #tblpage(temp_mes_a), w0 13 | mov #tbloffset(temp_mes_a), w1 14 | call tx_str_232 15 | 16 | mov #tblpage(temp_mes_yes), w0 17 | mov #tbloffset(temp_mes_yes), w1 18 | btss flags_rom, #use_temp_sensors 19 | mov #tblpage(temp_mes_no), w0 20 | btss flags_rom, #use_temp_sensors 21 | mov #tbloffset(temp_mes_no), w1 22 | call tx_str_232 23 | 24 | btsc flags_rom, #use_temp_sensors 25 | bra temp_msg_b 26 | 27 | bra temp_msg_z 28 | 29 | temp_opt_a: 30 | 31 | btg flags_rom, #use_temp_sensors 32 | 33 | bclr menus_completed, #mc_temp 34 | 35 | bra menu_temp 36 | 37 | ;------------------------------------------------------ 38 | ;b) identify temp sensors 39 | ;------------------------------------------------------ 40 | temp_msg_b: 41 | mov #tblpage(temp_mes_b), w0 42 | mov #tbloffset(temp_mes_b), w1 43 | call tx_str_232 44 | 45 | bra temp_msg_c 46 | 47 | temp_opt_b: 48 | call temp_read_ids 49 | ;print whatever message came from the identification routine 50 | call tx_str_232 51 | 52 | call rx_char_232 53 | 54 | bclr menus_completed, #mc_temp 55 | 56 | bra menu_temp 57 | 58 | ;------------------------------------------------------ 59 | ;c) temperature readings 60 | ;------------------------------------------------------ 61 | temp_msg_c: 62 | mov #tblpage(temp_mes_c), w0 63 | mov #tbloffset(temp_mes_c), w1 64 | call tx_str_232 65 | 66 | bra temp_msg_z 67 | 68 | temp_opt_c: 69 | call temperature_readings 70 | bra menu_temp 71 | ;------------------------------------------------------ 72 | ;z) return to main menu 73 | ;------------------------------------------------------ 74 | temp_msg_z: 75 | mov #tblpage(temp_mes_z), w0 76 | mov #tbloffset(temp_mes_z), w1 77 | call tx_str_232 78 | ;do not print sensor data when not in use 79 | btss flags_rom, #use_temp_sensors 80 | bra tmz_skip 81 | call print_sensor_ids 82 | call print_temp_limits 83 | tmz_skip: 84 | mov #'\n', w0 85 | call tx_char_232 86 | 87 | bra temp_msg_choise 88 | 89 | temp_opt_z: 90 | 91 | return 92 | 93 | ;------------------------------------------------------ 94 | temp_msg_choise: 95 | 96 | call get_choise 97 | 98 | mov #'a', w1 99 | cp w0, w1 100 | bra z, temp_opt_a 101 | 102 | btss flags_rom, #use_temp_sensors 103 | bra tmc_z 104 | 105 | mov #'b', w1 106 | cp w0, w1 107 | bra z, temp_opt_b 108 | mov #'c', w1 109 | cp w0, w1 110 | bra z, temp_opt_c 111 | 112 | call enter_temp_limits 113 | 114 | tmc_z: 115 | mov #'z', w1 116 | cp w0, w1 117 | bra z, temp_opt_z 118 | 119 | bra menu_temp 120 | 121 | ;********************************************************** 122 | 123 | temp_mes_a: 124 | .pascii "\na) use temp sensors: \0" 125 | temp_mes_b: 126 | .pascii "\nb) identify temp sensors\0" 127 | temp_mes_c: 128 | .pascii "\nc) temperature readings\0" 129 | temp_mes_z: 130 | .pascii "\n\nz) return to main menu\n\0" 131 | temp_mes_yes: 132 | .pascii "yes\0" 133 | temp_mes_no: 134 | .pascii "no\0" 135 | .end 136 | 137 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/menu_temp.s~: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global menu_battery 6 | menu_battery: 7 | call clr_scr_232 8 | ;------------------------------------------------------ 9 | ;a) battery voltage 10 | ;------------------------------------------------------ 11 | mov #tblpage(bat_mes_a), w0 12 | mov #tbloffset(bat_mes_a), w1 13 | call tx_str_232 14 | 15 | mov battery_voltage, w0 16 | lsr w0, #4, w0 17 | mov #str_buf, w1 18 | call word_to_udec_str 19 | mov #str_buf, w0 20 | call tx_ram_str_232 21 | 22 | mov battery_voltage, w0 23 | sl w0, #12, w0 24 | mov #str_buf, w1 25 | call word_to_01_str 26 | clr.b str_buf+2 27 | mov #str_buf, w0 28 | call tx_ram_str_232 29 | 30 | mov #tblpage(bat_mes_a1), w0 31 | mov #tbloffset(bat_mes_a1), w1 32 | call tx_str_232 33 | 34 | bra mb_msg_z 35 | 36 | mb_opt_a: 37 | 38 | mov #10, w0 39 | call get_signed_decimal_number 40 | 41 | sl w0, #4, w0 42 | lsr w1, #12, w1 43 | ior w0, w1, w0 44 | 45 | mov w0, battery_voltage 46 | 47 | bra menu_battery 48 | 49 | ;------------------------------------------------------ 50 | ;z) return to main menu 51 | ;------------------------------------------------------ 52 | mb_msg_z: 53 | mov #tblpage(bat_mes_z), w0 54 | mov #tbloffset(bat_mes_z), w1 55 | call tx_str_232 56 | 57 | bra mb_msg_choise 58 | mb_opt_z: 59 | return 60 | 61 | ;------------------------------------------------------ 62 | mb_msg_choise: 63 | 64 | call get_choise 65 | 66 | mov #'a', w1 67 | cp w0, w1 68 | bra z, mb_opt_a 69 | mov #'z', w1 70 | cp w0, w1 71 | bra z, mb_opt_z 72 | 73 | bra menu_battery 74 | 75 | ;********************************************************** 76 | 77 | bat_mes_a: 78 | .ascii "\na) battery voltage: \0" 79 | bat_mes_a1: 80 | .ascii " V\0" 81 | bat_mes_z: 82 | .ascii "\n\nz) return to main menu" 83 | .ascii "\n\n\0" 84 | 85 | 86 | 87 | .end 88 | 89 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/menu structure/report_checksum.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | 7 | .global report_checksum 8 | report_checksum: 9 | 10 | ;---------------------------------------------- initialise 11 | 12 | clr w4 13 | clr w5 14 | clr w6 15 | 16 | clr TBLPAG 17 | ;---------------------------------------------- compute checksum over variables to negate their effect 18 | 19 | mov #tbloffset(setup_rom) + 1024, w13 20 | 21 | rech_var_lp: 22 | 23 | tblrdl [w13], w0 24 | tblrdh [w13], w1 25 | ze w1, w1 26 | 27 | xor w4, w0, w4 28 | xor w6, w1, w6 29 | 30 | dec2 w13, w13 31 | mov #tbloffset(setup_rom) - 2, w0 32 | cp w13,w0 33 | bra z, rech_full 34 | 35 | tblrdl [w13], w0 36 | tblrdh [w13], w1 37 | sl w1, #8, w1 38 | 39 | xor w5, w0, w5 40 | xor w6, w1, w6 41 | 42 | dec2 w13, w13 43 | mov #tbloffset(setup_rom) - 2, w0 44 | cp w13,w0 45 | bra nz, rech_var_lp 46 | 47 | ;---------------------------------------------- start from beginning 48 | rech_full: 49 | 50 | mov #0x7FFC, w13 ;program memory address 51 | 52 | ;---------------------------------------------- loop over 32 kB 53 | rech_lp: 54 | 55 | ;---------------------------------------------- read memory and xor with checksum variables 56 | 57 | tblrdl [w13], w0 58 | tblrdh [w13], w1 59 | ze w1, w1 60 | 61 | xor w4, w0, w4 62 | xor w6, w1, w6 63 | 64 | dec2 w13, w13 65 | bra n, rech_lpend 66 | 67 | tblrdl [w13], w0 68 | tblrdh [w13], w1 69 | sl w1, #8, w1 70 | 71 | xor w5, w0, w5 72 | xor w6, w1, w6 73 | 74 | dec2 w13, w13 75 | bra n, rech_lpend 76 | 77 | ;---------------------------------------------- next iteration 78 | 79 | bra rech_lp 80 | 81 | ;---------------------------------------------- print checksum message 82 | rech_lpend: 83 | 84 | mov #tblpage(checksum_msg), w0 85 | mov #tbloffset(checksum_msg), w1 86 | call tx_str_232 87 | 88 | ;---------------------------------------------- print checksum output 89 | 90 | mov w4, w0 91 | mov #str_buf, w1 92 | call word_to_hex_str 93 | mov #str_buf, w0 94 | call tx_ram_str_232 95 | 96 | mov #' ', w0 97 | call tx_char_232 98 | 99 | mov w5, w0 100 | mov #str_buf, w1 101 | call word_to_hex_str 102 | mov #str_buf, w0 103 | call tx_ram_str_232 104 | 105 | mov #' ', w0 106 | call tx_char_232 107 | 108 | mov w6, w0 109 | mov #str_buf, w1 110 | call word_to_hex_str 111 | mov #str_buf, w0 112 | call tx_ram_str_232 113 | 114 | mov #'\n', w0 115 | call tx_char_232 116 | mov #'\n', w0 117 | call tx_char_232 118 | 119 | ;---------------------------------------------- wait for any key 120 | 121 | call rx_char_232 122 | 123 | ;---------------------------------------------- end 124 | 125 | return 126 | 127 | checksum_msg: 128 | .pascii "\n\n CHECKSUM : \0" 129 | 130 | .end 131 | 132 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/monitoring.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global monitoring 6 | monitoring: 7 | ;------------------------------ check for new command, store variable address if new 8 | ;rx-ed anything ? 9 | btss U2STA, #0 10 | bra moni_read_var ;if no: skip to read 11 | ;if yes, get character 12 | mov U2RXREG, w0 13 | 14 | nop 15 | nop 16 | 17 | ze w0, w0 18 | 19 | ;------------------------------ check that new command is in 0-9 range, else disable TX 20 | 21 | mov #'u'+1, w1 22 | cpslt w0, w1 23 | bra moni_disable_end 24 | 25 | mov #'a'-1, w1 26 | cpsgt w0, w1 27 | bra moni_disable_end 28 | 29 | ;------------------------------ in range, calculate variable address 30 | ;allow tx 31 | bset flags1, #tx_allowed 32 | ;get delta with 'a' 33 | mov #'a', w1 34 | sub w0, w1, w0 35 | ;times 4 36 | sl w0, #2, w0 37 | ;add to array offset 38 | mov #tblpage(variable_array), w1 39 | mov w1, TBLPAG 40 | mov #tbloffset(variable_array), w1 41 | add w0, w1, w1 42 | ;get RAM address variable 43 | tblrdl [w1], w2 44 | mov w2, tx_var_address 45 | 46 | ;------------------------------ transmit variable 47 | moni_read_var: 48 | ;only TX when allowed 49 | btss flags1, #tx_allowed 50 | return 51 | ;read value and TX 52 | mov tx_var_address, w2 53 | mov [w2], w0 54 | btg w0, #15 55 | call tx_word_232 56 | 57 | return 58 | 59 | ;------------------------------ disable TX when RX-ed outside of 0-9 60 | 61 | moni_disable_end: 62 | 63 | bclr flags1, #tx_allowed 64 | return 65 | 66 | 67 | 68 | .align 2 69 | variable_array: 70 | .word phi_motor, ;a 71 | .word phi_int, ;b 72 | .word filter_w8, ;c 73 | .word wanted_i_real, ;d 74 | .word ampli_real, ;e 75 | .word throttle_raw1, ;f 76 | .word throttle_raw2, ;g 77 | .word throttle, ;h 78 | .word adc_current_offset, ;i 79 | .word adc_current_offset+2, ;j 80 | .word adc_current_offset+4, ;k 81 | .word temp_data, ;l 82 | .word temp_data+2, ;m 83 | .word temp_data+4, ;n 84 | .word temp_data+6, ;o 85 | .word temp_data+8, ;p 86 | .word temp_data+10, ;q 87 | .word temp_data+12, ;r 88 | .word temp_data+14, ;s 89 | .word temp_red_i_max_phase, ;t 90 | .word filter_w9, ;u 91 | 92 | .word dummy1, ;v 93 | .word flags2, ;w 94 | .word filter_Q, ;x 95 | .word meas_L, ;y 96 | .word meas_R, ;z 97 | 98 | 99 | 100 | .end 101 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/Makefile-genesis.properties: -------------------------------------------------------------------------------- 1 | # 2 | #Fri Aug 31 15:05:35 CEST 2018 3 | default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=58290adfbf6a3a3c6b3ae076334b685d 4 | default.languagetoolchain.dir=/opt/microchip/xc16/v1.26/bin 5 | configurations-xml=b7b1ee05e5689d9c8e197d3c2b52281f 6 | com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=c8c2915d32f5d7e4be49831bc9827ab0 7 | default.languagetoolchain.version=1.26 8 | host.platform=linux 9 | conf.ids=default 10 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/Makefile-impl.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Generated Makefile - do not edit! 3 | # 4 | # Edit the Makefile in the project folder instead (../Makefile). Each target 5 | # has a pre- and a post- target defined where you can add customization code. 6 | # 7 | # This makefile implements macros and targets common to all configurations. 8 | # 9 | # NOCDDL 10 | 11 | 12 | # Building and Cleaning subprojects are done by default, but can be controlled with the SUB 13 | # macro. If SUB=no, subprojects will not be built or cleaned. The following macro 14 | # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf 15 | # and .clean-reqprojects-conf unless SUB has the value 'no' 16 | SUB_no=NO 17 | SUBPROJECTS=${SUB_${SUB}} 18 | BUILD_SUBPROJECTS_=.build-subprojects 19 | BUILD_SUBPROJECTS_NO= 20 | BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} 21 | CLEAN_SUBPROJECTS_=.clean-subprojects 22 | CLEAN_SUBPROJECTS_NO= 23 | CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} 24 | 25 | 26 | # Project Name 27 | PROJECTNAME=30F_powerstart_v2pA1.X 28 | 29 | # Active Configuration 30 | DEFAULTCONF=default 31 | CONF=${DEFAULTCONF} 32 | 33 | # All Configurations 34 | ALLCONFS=default 35 | 36 | 37 | # build 38 | .build-impl: .build-pre 39 | ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf 40 | 41 | 42 | # clean 43 | .clean-impl: .clean-pre 44 | ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf 45 | 46 | # clobber 47 | .clobber-impl: .clobber-pre .depcheck-impl 48 | ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean 49 | 50 | 51 | 52 | # all 53 | .all-impl: .all-pre .depcheck-impl 54 | ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build 55 | 56 | 57 | 58 | # dependency checking support 59 | .depcheck-impl: 60 | # @echo "# This code depends on make tool being used" >.dep.inc 61 | # @if [ -n "${MAKE_VERSION}" ]; then \ 62 | # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ 63 | # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ 64 | # echo "include \$${DEPFILES}" >>.dep.inc; \ 65 | # echo "endif" >>.dep.inc; \ 66 | # else \ 67 | # echo ".KEEP_STATE:" >>.dep.inc; \ 68 | # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ 69 | # fi 70 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/Makefile-local-default.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Generated Makefile - do not edit! 3 | # 4 | # 5 | # This file contains information about the location of compilers and other tools. 6 | # If you commmit this file into your revision control server, you will be able to 7 | # to checkout the project and build it from the command line with make. However, 8 | # if more than one person works on the same project, then this file might show 9 | # conflicts since different users are bound to have compilers in different places. 10 | # In that case you might choose to not commit this file and let MPLAB X recreate this file 11 | # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at 12 | # least once so the file gets created and the project can be built. Finally, you can also 13 | # avoid using this file at all if you are only building from the command line with make. 14 | # You can invoke make with the values of the macros: 15 | # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... 16 | # 17 | PATH_TO_IDE_BIN=/opt/microchip/mplabx/v4.15/mplab_ide/platform/../mplab_ide/modules/../../bin/ 18 | # Adding MPLAB X bin directory to path. 19 | PATH:=/opt/microchip/mplabx/v4.15/mplab_ide/platform/../mplab_ide/modules/../../bin/:$(PATH) 20 | # Path to java used to run MPLAB X when this makefile was created 21 | MP_JAVA_PATH="/opt/microchip/mplabx/v4.15/sys/java/jre1.8.0_144/bin/" 22 | OS_CURRENT="$(shell uname -s)" 23 | MP_CC="/opt/microchip/xc16/v1.26/bin/xc16-gcc" 24 | # MP_CPPC is not defined 25 | # MP_BC is not defined 26 | MP_AS="/opt/microchip/xc16/v1.26/bin/xc16-as" 27 | MP_LD="/opt/microchip/xc16/v1.26/bin/xc16-ld" 28 | MP_AR="/opt/microchip/xc16/v1.26/bin/xc16-ar" 29 | DEP_GEN=${MP_JAVA_PATH}java -jar "/opt/microchip/mplabx/v4.15/mplab_ide/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" 30 | MP_CC_DIR="/opt/microchip/xc16/v1.26/bin" 31 | # MP_CPPC_DIR is not defined 32 | # MP_BC_DIR is not defined 33 | MP_AS_DIR="/opt/microchip/xc16/v1.26/bin" 34 | MP_LD_DIR="/opt/microchip/xc16/v1.26/bin" 35 | MP_AR_DIR="/opt/microchip/xc16/v1.26/bin" 36 | # MP_BC_DIR is not defined 37 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/Makefile-variables.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Generated - do not edit! 3 | # 4 | # NOCDDL 5 | # 6 | CND_BASEDIR=`pwd` 7 | # default configuration 8 | CND_ARTIFACT_DIR_default=dist/default/production 9 | CND_ARTIFACT_NAME_default=30F_powerstart_v2pA1.X.production.hex 10 | CND_ARTIFACT_PATH_default=dist/default/production/30F_powerstart_v2pA1.X.production.hex 11 | CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package 12 | CND_PACKAGE_NAME_default=30fpowerstartv2pa1.x.tar 13 | CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/30fpowerstartv2pa1.x.tar 14 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/Package-default.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | # 4 | # Generated - do not edit! 5 | # 6 | 7 | # Macros 8 | TOP=`pwd` 9 | CND_CONF=default 10 | CND_DISTDIR=dist 11 | TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging 12 | TMPDIRNAME=tmp-packaging 13 | OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/30F_powerstart_v2pA1.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} 14 | OUTPUT_BASENAME=30F_powerstart_v2pA1.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} 15 | PACKAGE_TOP_DIR=30fpowerstartv2pa1.x/ 16 | 17 | # Functions 18 | function checkReturnCode 19 | { 20 | rc=$? 21 | if [ $rc != 0 ] 22 | then 23 | exit $rc 24 | fi 25 | } 26 | function makeDirectory 27 | # $1 directory path 28 | # $2 permission (optional) 29 | { 30 | mkdir -p "$1" 31 | checkReturnCode 32 | if [ "$2" != "" ] 33 | then 34 | chmod $2 "$1" 35 | checkReturnCode 36 | fi 37 | } 38 | function copyFileToTmpDir 39 | # $1 from-file path 40 | # $2 to-file path 41 | # $3 permission 42 | { 43 | cp "$1" "$2" 44 | checkReturnCode 45 | if [ "$3" != "" ] 46 | then 47 | chmod $3 "$2" 48 | checkReturnCode 49 | fi 50 | } 51 | 52 | # Setup 53 | cd "${TOP}" 54 | mkdir -p ${CND_DISTDIR}/${CND_CONF}/package 55 | rm -rf ${TMPDIR} 56 | mkdir -p ${TMPDIR} 57 | 58 | # Copy files and create directories and links 59 | cd "${TOP}" 60 | makeDirectory ${TMPDIR}/30fpowerstartv2pa1.x/bin 61 | copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 62 | 63 | 64 | # Generate tar file 65 | cd "${TOP}" 66 | rm -f ${CND_DISTDIR}/${CND_CONF}/package/30fpowerstartv2pa1.x.tar 67 | cd ${TMPDIR} 68 | tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/30fpowerstartv2pa1.x.tar * 69 | checkReturnCode 70 | 71 | # Cleanup 72 | cd "${TOP}" 73 | rm -rf ${TMPDIR} 74 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/private/SuppressibleMessageMemo.properties: -------------------------------------------------------------------------------- 1 | # 2 | #Sun Jan 05 18:59:39 CET 2014 3 | mdbDebugger/MEMORY_VIEW_LAST_HW_BP_RESOURCE_WARN=false 4 | pkobskde/CHECK_4_HIGH_VOLTAGE_VPP=false 5 | pk3/DEVID_MISMATCH=false 6 | mdbDebugger/NO_HW_COMBINER_RESOURCES_WARNING=false 7 | mdbDebugger/NO_HW_BP_RESOURCES_WARN=false 8 | mdbDebugger/MEMORY_VIEW_NO_HW_BP_RESOURCES_WARN=false 9 | pk3/CHECK_CLOCK=false 10 | mdbDebugger/LAST_HW_BP_RESOURCE_WARN=false 11 | pk3/CHECK_4_HIGH_VOLTAGE_VPP=true 12 | icd3/DEVID_MISMATCH=false 13 | realice/DEVID_MISMATCH=false 14 | realice/CHECK_CLOCK=false 15 | pkoblicdbgr/DEVID_MISMATCH=false 16 | pkoblicdbgr/CHECK_CLOCK=false 17 | pkobskde/DEVID_MISMATCH=false 18 | icd3/CHECK_CLOCK=false 19 | realice/CHECK_4_HIGH_VOLTAGE_VPP=false 20 | pkoblicdbgr/CHECK_4_HIGH_VOLTAGE_VPP=false 21 | pkobskde/CHECK_CLOCK=false 22 | icd3/CHECK_4_HIGH_VOLTAGE_VPP=false 23 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/private/configurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Makefile 4 | 0 5 | 6 | 7 | :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>900A:=<rev>0002:=<man>Microchip Technology Inc.:=<prod>PICkit 3:=<sn>BUR110375405:=<drv>x:=<xpt>h:=end 8 | /opt/microchip/xc16/v1.26/bin 9 | 10 | place holder 1 11 | place holder 2 12 | 13 | 14 | 15 | 16 | true 17 | 0 18 | 0 19 | 0 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/private/private.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/private/private.properties -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | testprograms/tb_find_hf_amplitude.s 6 | 25 7 | 8 | 9 | testprograms/tb_first_motor_run.s 10 | 153 11 | 12 | 13 | 14 | 15 | testprograms/tb_find_hf_amplitude.s 16 | 17 | 18 | 25 19 | 20 | 21 | 22 | 23 | testprograms/tb_first_motor_run.s 24 | 25 | 26 | 153 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/project.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casainho/Lebowski-controller-IC/b3df66bc8eebb5f27621dd04f393ca69eaf84367/src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/project.properties -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.microchip.mplab.nbide.embedded.makeproject 4 | 5 | 6 | 30F_powerstart 7 | da992c7f-d6da-48cb-910e-8284f3fc1a54 8 | 0 9 | 10 | 11 | 12 | ISO-8859-1 13 | inc 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/phase_corrections.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global calc_mfa_phase_cor 9 | ; 10 | ;corrupted variables: 11 | ; w0, w1, w2, w3, w4 12 | ; 13 | calc_mfa_phase_cor: 14 | ;--------------------------------------- phi_mfa_comp = 2^-2 * 2^16 * 2^-14 * mfa_x * I_real[lsb] / (2^12 + | 2^-14 * mfa_x * I_real[lsb] | ) 15 | mov mfa_x, w0 16 | ;later addition: correct with mfa_x_percentage 17 | mul mfa_x_percentage 18 | 19 | mov filter_w8+4, w1 20 | mul.us w3, w1, w2 21 | ;w3:w2 = 2^-2 * 2^16 * 2^-14 * mfa_x * wanted_I_real[lsb] 22 | ;w3:w2 = xxUU UUUU UUUU UUUU:UUyy yyyy yyyy yyyy 23 | sl w3, #2, w1 24 | lsr w2, #14, w0 25 | ior w1, w0, w0 26 | ;w0 = 2^-14 * mfa_x * wanted_I_real[lsb] 27 | btsc w0, #15 28 | neg w0, w0 29 | mov #4096, w1 30 | add w0, w1, w4 31 | ;w4 = 2^12 + | 2^-14 * mfa_x * wanted_I_real[lsb] | 32 | repeat #17 33 | div.sd w2, w4 34 | ;w0 = 2^-2 * 2^16 * 2^-14 * mfa_x * I_real[lsb] / (2^12 + | 2^-14 * mfa_x * I_real[lsb] | ) 35 | mov w0, phi_mfa_comp 36 | ;--------------------------------------- end 37 | return 38 | 39 | ;***************************************************************** 40 | 41 | .end 42 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/random_i_imag.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global initialise_rnd_walk 9 | initialise_rnd_walk: 10 | 11 | ;--------------------------------------- initialise 12 | ;initialise pseudo value 13 | mov #1, w0 14 | mov w0, pseudo_rnd 15 | mov w0, rnd_walk_count 16 | 17 | clr rnd_i_imag 18 | clr rnd_walk_val 19 | clr rnd_walk_update 20 | 21 | ;--------------------------------------- end 22 | return 23 | 24 | ;***************************************************************** 25 | 26 | .global reduce_rnd_i_imag 27 | reduce_rnd_i_imag: 28 | ;--------------------------------------- reduce 29 | ;reduce rnd_walk_out, 1 tau = 1000 steps 30 | mov rnd_walk_val, w0 31 | mov #65470, w1 32 | mul.us w1, w0, w0 33 | mov w1, rnd_walk_val 34 | ;--------------------------------------- convert to current and end 35 | bra rnd_to_i_imag 36 | 37 | ;***************************************************************** 38 | 39 | .global update_rnd_i_imag 40 | update_rnd_i_imag: 41 | 42 | ;--------------------------------------- are we allowed to run ? 43 | btss flags1, #allow_rnd_i_imag 44 | bra reduce_rnd_i_imag 45 | ;--------------------------------------- finished with count ? determine new values 46 | /* 47 | dec rnd_walk_count 48 | bra nz, rii_continue 49 | ;new pseudo rnd value 50 | mov pseudo_rnd, w0 51 | sl w0, #13, w1 52 | xor w0, w1, w0 53 | lsr w0, #9, w1 54 | xor w0, w1, w0 55 | sl w0, #7, w1 56 | xor w0, w1, w0 57 | mov w0, pseudo_rnd 58 | ;calculate update, reach in approx 512 steps 59 | mov pseudo_rnd, w0 60 | asr w0, #11, w0 61 | mov rnd_walk_val, w1 62 | asr w1, #11, w1 63 | sub w0, w1, w0 64 | mov w0, rnd_walk_update 65 | ;reset counter 66 | mov #2048, w0 67 | mov w0, rnd_walk_count 68 | ;end 69 | bra rii_end 70 | */ 71 | ;--------------------------------------- new rnd_walk_value 72 | rii_continue: 73 | mov #22, w0 74 | add phi_rw 75 | mov phi_rw, w0 76 | lsr w0, #7, w13 77 | bclr w13, #0 78 | bset w13, #11 79 | mov [w13], w0 80 | mov w0, rnd_walk_val 81 | 82 | /* 83 | ;new rnd_walk_value 84 | mov rnd_walk_update, w0 85 | mov rnd_walk_val, w1 86 | add w1, w0, w1 87 | btsc SR, #OV 88 | sub w1, w0, w1 89 | 90 | mov rnd_walk_val, w1 91 | ;remove any remaining DC !! (1 tau = 10000 steps) 92 | mov #65529, w0 93 | mul.us w0, w1, w0 94 | 95 | mov w1, rnd_walk_val 96 | */ 97 | rnd_to_i_imag: 98 | ;convert to current 99 | mov rnd_walk_val, w1 100 | mov data_current_limit_L, w0 101 | ;times 3 (rnd_walk_val is Q15) to get walk with 1.5 rimes data_current_limit_L amplitude) 102 | add data_current_limit_L, wreg 103 | add data_current_limit_L, wreg 104 | 105 | mul.us w0, w1, w0 106 | mov w1, rnd_i_imag 107 | ;--------------------------------------- end 108 | rii_end: 109 | ;for next time 110 | bset flags1, #allow_rnd_i_imag 111 | btss flags_rom, #use_rnd_i_imag 112 | bclr flags1, #allow_rnd_i_imag 113 | 114 | return 115 | .bss 116 | 117 | phi_rw:.space 2 118 | 119 | .end 120 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/reset_vector.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | 3 | config __FOSC, FRC_PLL16 & PRI & CSW_FSCM_OFF 4 | config __FBORPOR, PWRT_64 & PBOR_ON & BORV42 & MCLR_EN & RST_PWMPIN & PWMxL_ACT_HI & PWMxH_ACT_HI 5 | config __FWDT, WDT_OFF & WDTPSB_3 & WDTPSA_8 6 | config __FGS, GWRP_OFF & CODE_PROT_ON 7 | 8 | .bss 9 | .global stackpointer 10 | .align 2 11 | stackpointer: 12 | .space 64 13 | 14 | 15 | .section *,code ;,address (0x15A4) 16 | 17 | .global __reset 18 | __reset: 19 | 20 | mov #stackpointer, w15 21 | mov #stackpointer+62, w0 22 | mov w0, SPLIM 23 | 24 | bset TRISD, #3 25 | btss PORTD, #3 26 | goto main_menu 27 | 28 | goto main_motor 29 | 30 | 31 | 32 | 33 | 34 | .end 35 | 36 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/sine_i_imag.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global initialise_sine_walk 9 | initialise_sine_walk: 10 | 11 | ;--------------------------------------- initialise 12 | ;initialise pseudo value 13 | clr ampl_sine_iimag 14 | clr phi_sine_iimag 15 | ;set to 10 Hz (phiint = Hz*mlc/458) 16 | mov #10, w0 17 | mul main_loop_count 18 | mov #458, w4 19 | repeat #17 20 | div.ud w2, w4 21 | mov w0, phiint_sine_iimag 22 | 23 | ;--------------------------------------- end 24 | return 25 | 26 | 27 | ;***************************************************************** 28 | 29 | .global update_sine_i_imag 30 | update_sine_i_imag: 31 | ;--------------------------------------- update sine amplitude 32 | ;are we allowed to run ? increase or decrease amplitude 33 | mov #33, w0 34 | btss flags1, #allow_sine_iimag 35 | 36 | .global reduce_sine_i_imag 37 | reduce_sine_i_imag: 38 | 39 | mov #-33, w0 40 | mov #ampl_sine_iimag, w13 41 | 42 | add w0, [w13], w1 43 | btsc SR, #OV 44 | mov #0x7FF0, w1 45 | btsc w1, #15 46 | clr w1 47 | mov w1, [w13] 48 | /* 49 | ;filter, 1 tau = 1000 steps 50 | sub w0, [w13], w0 51 | mov #65, w1 52 | mul.us w1, w0, w0 53 | 54 | add w0, [++w13], [w13--] 55 | addc w1, [w13], [w13] 56 | 57 | ;--------------------------------------- update sine phase 58 | */ 59 | mov phiint_sine_iimag, w0 60 | add phi_sine_iimag 61 | 62 | ;--------------------------------------- generate output 63 | 64 | mov phi_sine_iimag, w0 65 | lsr w0, #7, w12 66 | bclr w12, #0 67 | bset w12, #11 68 | mov [w12], w0 69 | 70 | mul.ss w0, [w13], w0 71 | ;times 2 compensates for ampl_sine_iimag being Q15 72 | sl w1, w1 73 | ;times 3 (rnd_walk_val is Q15) to get walk with 1.5 rimes data_current_limit_L amplitude) 74 | mov data_current_limit_L, w0 75 | add data_current_limit_L, wreg 76 | add data_current_limit_L, wreg 77 | 78 | mul.us w0, w1, w0 79 | mov w1, sine_i_imag 80 | ;--------------------------------------- end 81 | ;for next time 82 | bset flags1, #allow_sine_iimag 83 | btss flags_rom, #use_sine_iimag 84 | bclr flags1, #allow_sine_iimag 85 | 86 | return 87 | 88 | 89 | .end 90 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/speed_control.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global speed_control 6 | speed_control: 7 | 8 | ;-------------------------------------- make sure current not too high or too low 9 | ;w1: upper limit: wir (forward) or imp/8 (reverse) 10 | ;w0: lower limit: -imp/8 (forward) or -wir (reverse) 11 | mov wanted_i_real, w1 12 | ;do not support throttle indicated regen 13 | btsc w1, #15 14 | clr w1 15 | 16 | mov i_max_phase, w0 17 | lsr w0, #3, w0 18 | btsc flags1, #reverse 19 | exch w0, w1 20 | neg w0, w0 21 | 22 | cp w8, w1 23 | bra ge, sc_subtract 24 | 25 | cp w8, w0 26 | bra le, sc_add 27 | 28 | ;-------------------------------------- else compare phase increase with wanted_phi_int 29 | 30 | mov filt_spd_ctrl, w0 31 | ;compare with wanted_phi_int 32 | cp wanted_phi_int 33 | bra le, sc_subtract 34 | 35 | ;-------------------------------------- increase amplitude 36 | sc_add: 37 | mov #ampli_real+2, w10 38 | ;place w12 at array of positive coeffs 39 | mov #alic_3+0, w12 40 | 41 | mov [w12++], w1 ;w1.w2 to be added to ampli_real (this is the 1st integrator bypass path) 42 | mov [w12++], w2 43 | ;add to ampli_real 44 | add w2, [w10], [w10--] 45 | addc w1, [w10], w0 46 | ;and don't forget the ampli_prop 47 | mov [w12], w1 48 | mov w1, ampli_prop 49 | ;at this point there should be no overflow 50 | bra ov, sc_overflow 51 | ;and we should be below ampli_upper_limit 52 | mov ampli_upper_limit, w1 53 | cp w0, w1 54 | bra ge, sc_toohigh_toolow 55 | ;and we should be above -ampli_upper_limit 56 | neg w1, w1 57 | cp w0, w1 58 | bra le, sc_toohigh_toolow 59 | 60 | mov w0, ampli_real 61 | 62 | return 63 | 64 | ;-------------------------------------- decrease amplitude 65 | sc_subtract: 66 | mov #ampli_real+2, w10 67 | ;place w12 at array of negative coeffs 68 | mov #alic_3+6, w12 69 | 70 | mov [w12++], w1 ;w1.w2 to be added to ampli_real (this is the 1st integrator bypass path) 71 | mov [w12++], w2 72 | ;add to ampli_real 73 | add w2, [w10], [w10--] 74 | addc w1, [w10], w0 75 | ;and don't forget the ampli_prop 76 | mov [w12], w1 77 | mov w1, ampli_prop 78 | ;at this point there should be no overflow 79 | bra ov, sc_overflow 80 | ;and we should be below ampli_max 81 | mov ampli_upper_limit, w1 82 | cp w0, w1 83 | bra ge, sc_toohigh_toolow 84 | ;and we should be above -ampli_max 85 | neg w1, w1 86 | cp w0, w1 87 | bra le, sc_toohigh_toolow 88 | 89 | mov w0, ampli_real 90 | 91 | return 92 | 93 | ;-------------------------------------- process overflow 94 | sc_overflow: 95 | ;since ampli_real was not updated so far we can use it's sign bit 96 | mov ampli_upper_limit, w1 97 | btsc ampli_real, #15 98 | neg w1, w1 99 | 100 | ;-------------------------------------- process too high or too low 101 | sc_toohigh_toolow: 102 | 103 | mov w1, ampli_real 104 | clr ampli_real+2 105 | clr ampli_prop 106 | 107 | return 108 | 109 | 110 | .end 111 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/temp_macros.s: -------------------------------------------------------------------------------- 1 | ;************************************************************************************ 2 | 3 | .macro T_return_main 4 | 5 | mov #6, w0 6 | add PCL, wreg 7 | mov w0, temp_readout 8 | return 9 | 10 | .endm 11 | 12 | ;************************************************************************************ 13 | 14 | .macro reset_temp_sensors 15 | 16 | ;---------------------------------------------- send reset pulse 17 | ;clr pin, low-Z 18 | bclr LATD, #1 19 | bclr TRISD, #1 20 | ;initialise timer for 600 usec 21 | mov #t2_600u, w0 22 | mov w0, PR2 23 | clr TMR2 24 | bclr IFS0, #6 25 | ;wait for timer to trip 26 | 1: 27 | T_return_main 28 | 29 | btss IFS0, #6 30 | bra 1b 31 | ;make pin high-Z 32 | bset TRISD, #1 33 | 34 | ;---------------------------------------------- wait for (possible) response 35 | ;initialise timer for 100 usec 36 | mov #t2_100u, w0 37 | mov w0, PR2 38 | clr TMR2 39 | bclr IFS0, #6 40 | ;wait for timer to trip 41 | 1: 42 | T_return_main 43 | 44 | btss IFS0, #6 45 | bra 1b 46 | ;read pin and (re)set temp_sensor_found 47 | bclr flags1, #temp_sensor_found 48 | btss PORTD, #1 49 | bset flags1, #temp_sensor_found 50 | ;---------------------------------------------- wait for 100usec after presence pulse 51 | ;wait for pin to be high 52 | 1: 53 | T_return_main 54 | 55 | btss PORTD, #1 56 | bra 1b 57 | ;initialise timer for 100 usec 58 | mov #t2_100u, w0 59 | mov w0, PR2 60 | clr TMR2 61 | bclr IFS0, #6 62 | ;wait for timer to trip 63 | 1: 64 | T_return_main 65 | 66 | btss IFS0, #6 67 | bra 1b 68 | ;---------------------------------------------- end 69 | .endm 70 | ;************************************************************************************ 71 | .macro skip_rom 72 | ;tx 0xCC, LSB's first 73 | call temp_send_0 74 | call temp_send_0 75 | call temp_send_1 76 | call temp_send_1 77 | call temp_send_0 78 | call temp_send_0 79 | call temp_send_1 80 | call temp_send_1 81 | .endm 82 | ;************************************************************************************ 83 | .macro all_convert 84 | ;tx 0x44, LSB's first 85 | call temp_send_0 86 | call temp_send_0 87 | call temp_send_1 88 | call temp_send_0 89 | call temp_send_0 90 | call temp_send_0 91 | call temp_send_1 92 | call temp_send_0 93 | .endm 94 | ;************************************************************************************ 95 | .macro match_rom 96 | ;tx 0x55, LSB's first 97 | call temp_send_1 98 | call temp_send_0 99 | call temp_send_1 100 | call temp_send_0 101 | call temp_send_1 102 | call temp_send_0 103 | call temp_send_1 104 | call temp_send_0 105 | .endm 106 | ;************************************************************************************ 107 | .macro read_scratchpad 108 | ;tx 0xBE, LSB's first 109 | call temp_send_0 110 | call temp_send_1 111 | call temp_send_1 112 | call temp_send_1 113 | call temp_send_1 114 | call temp_send_1 115 | call temp_send_0 116 | call temp_send_1 117 | .endm 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_angle_amplitude.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;wait for any key 15 | call rx_char_232 16 | 17 | ;---------------------------------------------- measure 18 | 19 | mov #-500, w8 20 | mov #500, w9 21 | call angle_amplitude 22 | 23 | ;---------------------------------------------- report 24 | 25 | push w9 26 | 27 | mov w8, w0 28 | mov #str_buf, w1 29 | call word_to_udec_str 30 | mov #str_buf, w0 31 | call tx_ram_str_232 32 | 33 | mov #'\n', w0 34 | call tx_char_232 35 | 36 | pop w9 37 | 38 | mov w9, w0 39 | mov #str_buf, w1 40 | call word_to_udec_str 41 | mov #str_buf, w0 42 | call tx_ram_str_232 43 | 44 | mov #'\n', w0 45 | call tx_char_232 46 | mov #'\n', w0 47 | call tx_char_232 48 | 49 | hangloop: 50 | bra hangloop 51 | 52 | 53 | .end 54 | 55 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_export_XY_coordinates.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main_tb 9 | main_tb: 10 | 11 | ;---------------------------------------------- initialise 12 | call initialise 13 | 14 | mov #120, w0 15 | mov w0, monitoring_value 16 | ;turn off and wait for signal from labview 17 | bclr PTCON, #15 18 | call rx_char_232 19 | 20 | clr w0 21 | call tx_word_232 22 | clr w0 23 | call tx_word_232 24 | clr w0 25 | call tx_word_232 26 | mov #61642, w0 27 | call tx_word_232 28 | 29 | ;ADC to current sensors 30 | call ADC_current 31 | repeat #5 32 | nop 33 | bclr ADCON1, #1 34 | ;turn on PWM 35 | bset PTCON, #15 36 | 37 | mov #43000, w0 38 | mov w0, adc_gain_correction 39 | mov #43000, w0 40 | mov w0, adc_gain_correction+2 41 | mov #43000, w0 42 | mov w0, adc_gain_correction+4 43 | 44 | bclr flags123, #0 45 | 46 | igc_loop: 47 | ;wait for 40 kHz operation 48 | btss IFS0, #3 49 | bra igc_loop 50 | bclr IFS0, #3 51 | ;---------------------------------------------- get measured currents 52 | call ADC_read_current 53 | bclr ADCON1, #1 54 | ;---------------------------------------------- hf amplitude control 55 | mov i_hf_fixed, w7 56 | call hf_control 57 | ;---------------------------------------------- hf position demod 58 | call hf_position_demod 59 | ;---------------------------------------------- send signals to motor 60 | mov #2048, w0 61 | add phi_hf_motor 62 | 63 | call write_motor_sinus 64 | ;---------------------------------------------- loop end, allow monitoring 65 | dec monitoring_count 66 | bra nz, igc_loop 67 | mov monitoring_value, w0 68 | mov w0, monitoring_count 69 | 70 | btg flags123, #0 71 | mov filter_I+4, w0 72 | btss flags123, #0 73 | mov filter_Q+4, w0 74 | 75 | btg w0, #15 76 | call tx_word_232 77 | 78 | bra igc_loop 79 | 80 | 81 | .bss 82 | monitoring_count: .space 2 83 | flags123:.space 2 84 | .end 85 | 86 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_filter_2nd_order.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;wait for any key 15 | call rx_char_232 16 | ;initialise filter array 17 | mov #filter_I, w11 18 | repeat #3 19 | clr [w11++] 20 | 21 | ;---------------------------------------------- loop 22 | mlp: 23 | ;---------------------------------------------- calculate filter response 24 | 25 | mov #1000, w8 26 | mov #filter_I, w13 27 | mov #5, w11 28 | mov #10, w12 29 | 30 | call filter_2nd_order 31 | 32 | ;---------------------------------------------- transmit filter output 33 | 34 | mov filter_I+4, w0 35 | btg w0, #15 36 | call tx_word_232 37 | 38 | ;---------------------------------------------- loop 39 | 40 | bra mlp 41 | 42 | ;---------------------------------------------- end 43 | 44 | .end 45 | 46 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_filter_4th_order.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;wait for any key 15 | call rx_char_232 16 | ;initialise filter array 17 | mov #filter_A, w11 18 | repeat #7 19 | clr [w11++] 20 | 21 | ;---------------------------------------------- loop 22 | mlp: 23 | ;---------------------------------------------- calculate filter response 24 | 25 | mov #1000, w1 26 | mov #filter_A, w11 27 | 28 | call filter_4th_order 29 | 30 | ;---------------------------------------------- transmit filter output 31 | 32 | mov filter_A+12, w0 33 | btg w0, #15 34 | call tx_word_232 35 | 36 | ;---------------------------------------------- loop 37 | 38 | bra mlp 39 | 40 | ;---------------------------------------------- end 41 | 42 | .end 43 | 44 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_filter_dc_notch.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;initialise filter array 15 | mov #dc_notch_array, w0 16 | repeat #5 17 | clr [w0++] 18 | 19 | mov #7000, w0 20 | mov w0, notch_alpha 21 | 22 | ;---------------------------------------------- loop 23 | mlp: 24 | ;wait for any key 25 | call rx_char_232 26 | 27 | ;---------------------------------------------- calculate filter response 28 | 29 | mov #1000, w4 30 | call filter_dc_notch 31 | 32 | ;---------------------------------------------- transmit filter output 33 | 34 | mov w4, w0 35 | mov #str_buf, w1 36 | call word_to_sdec_str 37 | mov #str_buf, w0 38 | call tx_ram_str_232 39 | 40 | mov #'\n', w0 41 | call tx_char_232 42 | 43 | 44 | ;---------------------------------------------- loop 45 | 46 | bra mlp 47 | 48 | ;---------------------------------------------- end 49 | 50 | .end 51 | 52 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_filter_lpf.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;initialise filter array 15 | mov #lpf_array, w0 16 | repeat #7 17 | clr [w0++] 18 | 19 | mov #3277, w0 20 | mov w0, lpf_alpha 21 | 22 | ;---------------------------------------------- loop 23 | mlp: 24 | ;wait for any key 25 | call rx_char_232 26 | 27 | ;---------------------------------------------- calculate filter response 28 | 29 | mov #1000, w8 30 | mov #100, w9 31 | call filter_lpf 32 | 33 | ;---------------------------------------------- transmit filter output 34 | 35 | mov w8, w0 36 | mov #str_buf, w1 37 | call word_to_sdec_str 38 | mov #str_buf, w0 39 | call tx_ram_str_232 40 | 41 | mov #'\n', w0 42 | call tx_char_232 43 | 44 | 45 | ;---------------------------------------------- loop 46 | 47 | bra mlp 48 | 49 | ;---------------------------------------------- end 50 | 51 | .end 52 | 53 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_filter_notches.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;initialise filter array 15 | mov #notch_array, w0 16 | repeat #20 17 | clr [w0++] 18 | 19 | 20 | ;---------------------------------------------- loop 21 | mlp: 22 | ;wait for any key 23 | call rx_char_232 24 | 25 | ;---------------------------------------------- calculate filter response 26 | 27 | mov #3000, w6 28 | clr w4 29 | clr w5 30 | call filter_notches 31 | 32 | ;---------------------------------------------- transmit filter output 33 | 34 | mov w6, w0 35 | mov #str_buf, w1 36 | call word_to_sdec_str 37 | mov #str_buf, w0 38 | call tx_ram_str_232 39 | 40 | mov #'\n', w0 41 | call tx_char_232 42 | 43 | 44 | ;---------------------------------------------- loop 45 | 46 | bra mlp 47 | 48 | ;---------------------------------------------- end 49 | 50 | .end 51 | 52 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_find_dualtone_amplitude.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;wait for any key 15 | call rx_char_232 16 | 17 | ;---------------------------------------------- measure 18 | 19 | call find_dualtone_amplitude 20 | 21 | ;---------------------------------------------- report 22 | 23 | mov ampli_tone3, w0 24 | mov #str_buf, w1 25 | call word_to_udec_str 26 | mov #str_buf, w0 27 | call tx_ram_str_232 28 | 29 | mov #'\n', w0 30 | call tx_char_232 31 | 32 | mov ampli_tone4, w0 33 | mov #str_buf, w1 34 | call word_to_udec_str 35 | mov #str_buf, w0 36 | call tx_ram_str_232 37 | 38 | mov #'\n', w0 39 | call tx_char_232 40 | mov #'\n', w0 41 | call tx_char_232 42 | 43 | hangloop: 44 | bra hangloop 45 | 46 | 47 | .end 48 | 49 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_floatingpoint.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | .include "print_macros.mac" 4 | 5 | .text 6 | 7 | ;***************************************************************** 8 | 9 | .global fp_main 10 | fp_main: 11 | 12 | nop 13 | nop 14 | nop 15 | 16 | mov #-8, w0 17 | mov w0, regA 18 | mov #20529, w0 19 | mov w0, regA+2 20 | 21 | mov #-10, w0 22 | mov w0, regB 23 | mov #-22008, w0 24 | mov w0, regB+2 25 | 26 | mov #regA, w12 27 | mov #regB, w13 28 | call fp_add 29 | 30 | print_txt eq 31 | print_fp regB 32 | 33 | mov #-8, w0 34 | mov w0, regA 35 | mov #20529, w0 36 | mov w0, regA+2 37 | 38 | mov #-10, w0 39 | mov w0, regB 40 | mov #-22008, w0 41 | mov w0, regB+2 42 | 43 | mov #regB, w12 44 | mov #regA, w13 45 | call fp_add 46 | 47 | print_tab 48 | print_fp regA 49 | 50 | nop 51 | nop 52 | nop 53 | 54 | hangloop: 55 | bra hangloop 56 | 57 | 58 | eq: 59 | .pascii "A = 80.1914\n" 60 | .pascii "B = -21.4922\n" 61 | .pascii "A+B, B+A= \0" 62 | 63 | .bss 64 | regA: .space 2*fp_N 65 | regB: .space 2*fp_N 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_initial_gain_cal.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | call initialise 13 | call rx_char_232 14 | ;get hf values 15 | mov #1000, w0 16 | mov w0, wanted_i_hf 17 | call find_hf_amplitude_adc_offset 18 | retry: 19 | call initial_gain_cal 20 | 21 | mov filter_I+4, w0 22 | mov #str_buf, w1 23 | call word_to_sdec_str 24 | mov #str_buf, w0 25 | call tx_ram_str_232 26 | 27 | mov #'\t', w0 28 | call tx_char_232 29 | 30 | mov filter_Q+4, w0 31 | mov #str_buf, w1 32 | call word_to_sdec_str 33 | mov #str_buf, w0 34 | call tx_ram_str_232 35 | 36 | mov #'\n', w0 37 | call tx_char_232 38 | 39 | mov adc_gain_correction, w0 40 | mov #str_buf, w1 41 | call word_to_01_str 42 | mov #str_buf, w0 43 | call tx_ram_str_232 44 | 45 | mov #'\t', w0 46 | call tx_char_232 47 | 48 | mov adc_gain_correction+2, w0 49 | mov #str_buf, w1 50 | call word_to_01_str 51 | mov #str_buf, w0 52 | call tx_ram_str_232 53 | 54 | mov #'\t', w0 55 | call tx_char_232 56 | 57 | mov adc_gain_correction+4, w0 58 | mov #str_buf, w1 59 | call word_to_01_str 60 | mov #str_buf, w0 61 | call tx_ram_str_232 62 | 63 | mov #'\n', w0 64 | call tx_char_232 65 | mov #'\n', w0 66 | call tx_char_232 67 | 68 | ;---------------------------------------------- again 69 | bra retry 70 | 71 | 72 | .end 73 | 74 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_instability.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global tb_instability 9 | tb_instability: 10 | call ADC_current 11 | call reset_filters 12 | call clear_variables 13 | ;indicate tb 14 | bclr LATC, #15 15 | bset LATC, #13 16 | bclr LATC, #14 17 | bset LATE, #8 18 | 19 | bset PTCON, #15 20 | 21 | mov phi_int_max_erpm+2, w0 22 | mov w0, phi_int 23 | mov i_filter_offset, w0 24 | mov w0, wanted_i_real 25 | clr wanted_i_imag 26 | 27 | tb_lp: 28 | ;wait for 40 kHz operation 29 | bclr LATD, #2 30 | btss IFS0, #3 31 | bra tb_lp 32 | bclr IFS0, #3 33 | ;indicate when busy 34 | bset LATD, #2 35 | 36 | ;---------------------------------------------- get measured currents 37 | bclr ADCON1, #1 38 | nop 39 | nop 40 | 41 | call ADC_read_current 42 | ;---------------------------------------------- process throttle based on TMR4 43 | ; btsc IFS1, #5 44 | ; call throttle_read 45 | ;---------------------------------------------- demodulate 46 | mov phi_motor, w0 47 | call positive_demod 48 | ;---------------------------------------------- current filtering 49 | call current_filtering 50 | ;---------------------------------------------- torque/current control 51 | call current_control 52 | ;---------------------------------------------- calculate ampli_imag 53 | call calc_ampli_imag 54 | ;---------------------------------------------- phase control 55 | mov phi_int, w0 56 | add phi_motor 57 | 58 | ; mov #plic_3, w12 59 | ; call backemf_phase_control 60 | ;---------------------------------------------- send signals to motor 61 | call write_motor_sinus 62 | ;---------------------------------------------- drive_3 loop end, allow monitoring 63 | btss PORTD, #3 64 | bra tb_lp2 65 | 66 | dec monitoring_count 67 | bra nz, tb_lp 68 | mov monitoring_value, w0 69 | mov w0, monitoring_count 70 | call monitoring 71 | bra tb_lp 72 | 73 | 74 | ;*************************************************** 75 | ; second half 76 | ;*************************************************** 77 | 78 | tb_lp2: 79 | ;wait for 40 kHz operation 80 | bclr LATD, #2 81 | btss IFS0, #3 82 | bra tb_lp2 83 | bclr IFS0, #3 84 | ;indicate when busy 85 | bset LATD, #2 86 | 87 | ;---------------------------------------------- get measured currents 88 | bclr ADCON1, #1 89 | nop 90 | nop 91 | 92 | call ADC_read_current 93 | ;---------------------------------------------- process throttle based on TMR4 94 | ; btsc IFS1, #5 95 | ; call throttle_read 96 | ;---------------------------------------------- demodulate 97 | mov phi_motor, w0 98 | call positive_demod 99 | ;---------------------------------------------- current filtering 100 | call current_filtering 101 | ;---------------------------------------------- torque/current control 102 | call current_control 103 | ;---------------------------------------------- calculate ampli_imag 104 | call calc_ampli_imag 105 | ;---------------------------------------------- phase control 106 | ; mov phi_int, w0 107 | ; add phi_motor 108 | 109 | mov #plic_3, w12 110 | call backemf_phase_control 111 | ;---------------------------------------------- send signals to motor 112 | call write_motor_sinus 113 | ;---------------------------------------------- drive_3 loop end, allow monitoring 114 | dec monitoring_count 115 | bra nz, tb_lp2 116 | mov monitoring_value, w0 117 | mov w0, monitoring_count 118 | call monitoring 119 | bra tb_lp2 120 | 121 | 122 | .end 123 | 124 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_instability.s~: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;wait for any key 15 | call rx_char_232 16 | 17 | mov #1000, w8 18 | 19 | ;---------------------------------------------- loop 20 | mlp: 21 | ;---------------------------------------------- calculate filter response 22 | 23 | 24 | mov #notch_2hf_I, w13 25 | call notch_2hf 26 | 27 | mov #notch_hf_I, w13 28 | call notch_hf 29 | 30 | ;---------------------------------------------- transmit filter output 31 | 32 | mov w8, w0 33 | btg w0, #15 34 | call tx_word_232 35 | 36 | ;---------------------------------------------- loop 37 | 38 | clr w8 39 | 40 | bra mlp 41 | 42 | ;---------------------------------------------- end 43 | 44 | .end 45 | 46 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_inv_vbat.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;wait for any key 15 | call rx_char_232 16 | ;initialise filter array 17 | call reset_filters 18 | 19 | 20 | mov #1000, w0 21 | mov w0, counter 22 | ;---------------------------------------------- loop value 1 23 | 24 | mlp1: 25 | clr supply_voltage 26 | call inverse_vbat 27 | 28 | mov filter_inv_vbat, w0 29 | call tx_word_232 30 | 31 | dec counter 32 | bra nz, mlp1 33 | 34 | ;---------------------------------------------- loop value 2 35 | mov #1000, w0 36 | mov w0, counter 37 | mlp2: 38 | mov #1020, w0 39 | mov w0, supply_voltage 40 | call inverse_vbat 41 | 42 | mov filter_inv_vbat, w0 43 | call tx_word_232 44 | 45 | dec counter 46 | bra nz,mlp2 47 | 48 | ;---------------------------------------------- loop value 3 49 | 50 | mov #3000, w0 51 | mov w0, counter 52 | mlp3: 53 | mov #520, w0 54 | mov w0, supply_voltage 55 | call inverse_vbat 56 | 57 | mov filter_inv_vbat, w0 58 | call tx_word_232 59 | 60 | dec counter 61 | bra nz,mlp3 62 | 63 | ;---------------------------------------------- loop value 4 64 | 65 | mov #1000, w0 66 | mov w0, counter 67 | mlp4: 68 | mov #900, w0 69 | mov w0, supply_voltage 70 | call inverse_vbat 71 | 72 | mov filter_inv_vbat, w0 73 | call tx_word_232 74 | 75 | dec counter 76 | bra nz,mlp4 77 | 78 | ;---------------------------------------------- loop value 5 79 | 80 | mov #1000, w0 81 | mov w0, counter 82 | mlp5: 83 | mov #600, w0 84 | mov w0, supply_voltage 85 | call inverse_vbat 86 | 87 | mov filter_inv_vbat, w0 88 | call tx_word_232 89 | 90 | dec counter 91 | bra nz,mlp5 92 | 93 | ;---------------------------------------------- end 94 | 95 | hangloop: 96 | call tx_word_232 97 | 98 | bra hangloop 99 | 100 | .end 101 | 102 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_motor_sinus.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main_tb 9 | main_tb: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | bclr PTCON, #15 15 | ;wait for any key 16 | call rx_char_232 17 | 18 | mov #1000, w0 19 | mov w0, pwm_period 20 | mov #32760, w0 21 | mov w0, ampli_real 22 | mov #0, w0 23 | mov w0, ampli_imag 24 | mov #0, w0 25 | mov w0, ampli_hf_motor 26 | 27 | clr phi_hf_motor 28 | clr phi_prop 29 | clr ampli_prop 30 | clr phi_motor 31 | 32 | ;---------------------------------------------- report 33 | lp: 34 | call write_motor_sinus 35 | 36 | push w6 37 | push w5 38 | 39 | mov w4, w0 40 | mov #str_buf, w1 41 | call word_to_udec_str 42 | mov #str_buf, w0 43 | call tx_ram_str_232 44 | 45 | mov #'\t', w0 46 | call tx_char_232 47 | 48 | pop w0 49 | mov #str_buf, w1 50 | call word_to_udec_str 51 | mov #str_buf, w0 52 | call tx_ram_str_232 53 | 54 | mov #'\t', w0 55 | call tx_char_232 56 | 57 | pop w0 58 | mov #str_buf, w1 59 | call word_to_udec_str 60 | mov #str_buf, w0 61 | call tx_ram_str_232 62 | 63 | mov #'\n', w0 64 | call tx_char_232 65 | 66 | mov #256, w0 67 | add phi_motor 68 | 69 | bra nz, lp 70 | 71 | hangloop: 72 | bra hangloop 73 | 74 | 75 | .end 76 | 77 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_motor_sinus.s~: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;wait for any key 15 | call rx_char_232 16 | 17 | ;---------------------------------------------- measure 18 | 19 | mov #-120, w8 20 | mov #-400, w9 21 | call angle_amplitude 22 | 23 | ;---------------------------------------------- report 24 | 25 | push w9 26 | 27 | mov w8, w0 28 | mov #str_buf, w1 29 | call word_to_udec_str 30 | mov #str_buf, w0 31 | call tx_ram_str_232 32 | 33 | mov #'\n', w0 34 | call tx_char_232 35 | 36 | pop w9 37 | 38 | mov w9, w0 39 | mov #str_buf, w1 40 | call word_to_udec_str 41 | mov #str_buf, w0 42 | call tx_ram_str_232 43 | 44 | mov #'\n', w0 45 | call tx_char_232 46 | mov #'\n', w0 47 | call tx_char_232 48 | 49 | hangloop: 50 | bra hangloop 51 | 52 | 53 | .end 54 | 55 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_not_cont_PWM.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main_tb 9 | main_tb: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | bclr PTCON, #15 15 | 16 | ;---------------------------------------------- set PWM registers for single event mode 17 | 18 | ;pwm time base off for now, postscale 1:1, prescale 1:1, single event 19 | mov #0b0000000000000001, w0 20 | mov w0, PTCON 21 | ;use double pwm_period as single ramp instead of double 22 | mov pwm_period, w0 23 | sl w0, w0 24 | mov w0, PTPER 25 | 26 | ;initialise dutycycle 27 | mov pwm_period, w0 28 | add pwm_period, wreg 29 | add pwm_period, wreg 30 | mov w0, PDC1 31 | mov w0, PDC2 32 | mov w0, PDC3 33 | 34 | 35 | ;---------------------------------------------- pulse once every millisecond 36 | mov #40, w0 37 | mov w0, counter 38 | tb1: 39 | ;wait for 40 kHz operation 40 | btss IFS0, #3 41 | bra tb1 42 | bclr IFS0, #3 43 | ;---------------------------------------------- dec counter, pulse when 0 44 | dec counter 45 | bra nz, tb1 46 | 47 | mov #40, w0 48 | mov w0, counter 49 | 50 | bset PTCON, #15 51 | ;---------------------------------------------- loop 52 | bra tb1 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | .end 63 | 64 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_notch_filters.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;wait for any key 15 | call rx_char_232 16 | 17 | mov #1000, w8 18 | 19 | ;---------------------------------------------- loop 20 | mlp: 21 | ;---------------------------------------------- calculate filter response 22 | 23 | 24 | mov #notch_2hf_I, w13 25 | call notch_2hf 26 | 27 | mov #notch_hf_I, w13 28 | call notch_hf 29 | 30 | ;---------------------------------------------- transmit filter output 31 | 32 | mov w8, w0 33 | btg w0, #15 34 | call tx_word_232 35 | 36 | ;---------------------------------------------- loop 37 | 38 | clr w8 39 | 40 | bra mlp 41 | 42 | ;---------------------------------------------- end 43 | 44 | .end 45 | 46 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_pwm_filter_notches.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;initialise filter array 15 | mov #pwm_notch_array, w0 16 | repeat #14 17 | clr [w0++] 18 | 19 | mov #6554, w0 20 | mov w0, pwm_notch_alpha 21 | 22 | ;---------------------------------------------- loop 23 | mlp: 24 | ;wait for any key 25 | call rx_char_232 26 | 27 | ;---------------------------------------------- calculate filter response 28 | 29 | mov #1000, w4 30 | call pwm_filter_notches 31 | 32 | ;---------------------------------------------- transmit filter output 33 | 34 | mov w4, w0 35 | mov #str_buf, w1 36 | call word_to_sdec_str 37 | mov #str_buf, w0 38 | call tx_ram_str_232 39 | 40 | mov #'\n', w0 41 | call tx_char_232 42 | 43 | 44 | ;---------------------------------------------- loop 45 | 46 | bra mlp 47 | 48 | ;---------------------------------------------- end 49 | 50 | .end 51 | 52 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_sintable.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | ;global initialise 13 | call initialise 14 | ;wait for any key 15 | call rx_char_232 16 | 17 | clr w11 18 | mov #256, w10 19 | mov #data_array_sin, w13 20 | 21 | ;---------------------------------------------- loop 22 | mlp: 23 | 24 | ;---------------------------------------------- retrieve sine 25 | 26 | mov [w13++], w0 27 | add w11, w0, w11 28 | 29 | push w13 30 | push w11 31 | push w10 32 | ;---------------------------------------------- transmit filter output 33 | 34 | mov #str_buf, w1 35 | call word_to_sdec_str 36 | mov #str_buf, w0 37 | call tx_ram_str_232 38 | 39 | mov #'\n', w0 40 | call tx_char_232 41 | 42 | ;---------------------------------------------- loop 43 | pop w10 44 | pop w11 45 | pop w13 46 | 47 | dec w10, w10 48 | bra nz, mlp 49 | ;---------------------------------------------- end 50 | 51 | mov #'\n', w0 52 | call tx_char_232 53 | mov #'\n', w0 54 | call tx_char_232 55 | mov #'\n', w0 56 | call tx_char_232 57 | ;print total 58 | mov w11, w0 59 | mov #str_buf, w1 60 | call word_to_sdec_str 61 | mov #str_buf, w0 62 | call tx_ram_str_232 63 | 64 | mov #'\n', w0 65 | call tx_char_232 66 | 67 | 68 | 69 | hangloop: 70 | bra hangloop 71 | 72 | 73 | .end 74 | 75 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_temp_reset.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | .include "temp_macros.s" 4 | 5 | .text 6 | 7 | ;***************************************************************** 8 | 9 | .global main_tb 10 | main_tb: 11 | 12 | ;---------------------------------------------- initialise 13 | ;global initialise 14 | call initialise 15 | 16 | ;---------------------------------------------- main loop 17 | mlp: 18 | ;wait for 40 kHz operation 19 | bclr LATD, #2 20 | btss IFS0, #3 21 | bra mlp 22 | bclr IFS0, #3 23 | ;indicate when busy 24 | bset LATD, #2 25 | 26 | mov temp_readout, w14 27 | call w14 28 | 29 | bra mlp 30 | 31 | 32 | ;*********************************************** 33 | 34 | ;---------------------------------------------- temp routine 35 | .global tb_temp_reset 36 | tb_temp_reset: 37 | 38 | reset_temp_sensors 39 | 40 | bra tb_temp_reset 41 | 42 | .end 43 | 44 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_transition.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | .macro write_motor_sin 8 | mov ampli_real, w0 9 | add ampli_prop, wreg 10 | btsc SR, #OV 11 | mov ampli_real, w0 12 | mov w0, w11 13 | ;ampli_imag mainly positive, overflow always towards positive end 14 | mov ampli_imag, w0 15 | add ampli_imag_prop, wreg 16 | btsc SR, #OV 17 | mov ampli_imag, w0 18 | mov w0, w12 19 | ;get current position in sin array [w13] 20 | mov phi_motor, w0 21 | add phi_prop, wreg 22 | lsr w0, #7, w13 23 | bclr w13, #0 24 | bset w13, #11 25 | ;w8 = w11*[w13+90] - w12*[w13] 26 | ;w9 = w11*[w13] + w12*[w13+90] 27 | mul.ss w12, [w13], w0 28 | neg w1, w8 29 | mul.ss w11, [w13], w0 30 | mov w1, w9 31 | 32 | add #128, w13 33 | bclr w13, #9 34 | 35 | mul.ss w11, [w13], w0 36 | add w1, w8, w8 37 | mul.ss w12, [w13], w0 38 | add w1, w9, w9 39 | .endm 40 | ;***************************************************************** 41 | 42 | 43 | nop 44 | nop 45 | nop 46 | 47 | call fill_pwm_and_sin_arrays 48 | 49 | clr phi_motor 50 | clr phi_prop 51 | 52 | mov #6667, w4 53 | mov #-3333, w5 54 | mov #-3333, w6 55 | 56 | mov phi_motor, w0 57 | call demod 58 | 59 | mov #8000, w0 60 | mov w0, ampli_real 61 | mov w0, ampli_imag 62 | clr ampli_prop 63 | clr ampli_imag_prop 64 | 65 | write_motor_sin 66 | 67 | mov #6000, w0 68 | mov w0, ampli_imag_dr2hl 69 | bclr flags1, #reverse 70 | ;determine phi_offset and perform initial phase step 71 | call phase_step_dr23hl 72 | 73 | ;now we are in drive 23 74 | 75 | mov phi_motor, w0 76 | add phi_offset, wreg 77 | call demod 78 | 79 | nop 80 | 81 | write_motor_sin 82 | 83 | 84 | - nop 85 | nop 86 | nop 87 | 88 | 89 | 90 | 91 | .end 92 | 93 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/testprograms/tb_view_signals.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | 6 | ;***************************************************************** 7 | 8 | .global main 9 | main: 10 | 11 | ;---------------------------------------------- initialise 12 | call initialise 13 | ; call rx_char_232 14 | 15 | mov #12, w0 16 | mov w0, monitoring_value 17 | ;get hf values 18 | mov #1500, w0 19 | mov w0, wanted_i_hf 20 | call find_hf_amplitude_adc_offset 21 | 22 | bset PTCON, #15 23 | 24 | mov #32768, w0 25 | mov w0, phi_motor 26 | clr ampli_real 27 | clr ampli_imag 28 | mov #7500, w0 29 | mov w0, i_force_position 30 | call force_motor_position 31 | 32 | mov ampli_hf_for_i, w0 33 | mov w0, ampli_hf_motor 34 | ;ADC to current sensors 35 | call ADC_current 36 | repeat #5 37 | nop 38 | bclr ADCON1, #1 39 | ;turn on PWM 40 | bset PTCON, #15 41 | 42 | mov #44623, w0 43 | mov w0, adc_gain_correction 44 | mov #44584, w0 45 | mov w0, adc_gain_correction+2 46 | mov #41969, w0 47 | mov w0, adc_gain_correction+4 48 | 49 | 50 | igc_loop: 51 | ;wait for 40 kHz operation 52 | btss IFS0, #3 53 | bra igc_loop 54 | bclr IFS0, #3 55 | ;---------------------------------------------- get measured currents 56 | call ADC_read_current 57 | bclr ADCON1, #1 58 | ;---------------------------------------------- negative demod 59 | mov phi_hf_motor, w0 60 | add phi_rotation_hf, wreg 61 | call negative_demod 62 | ;---------------------------------------------- notch filtering 63 | 64 | mov #notch_hf_I, w13 65 | call notch_hf 66 | mov #notch_2hf_I,w13 67 | call notch_2hf 68 | exch w8, w9 69 | mov #notch_hf_Q, w13 70 | call notch_hf 71 | mov #notch_2hf_Q,w13 72 | call notch_2hf 73 | exch w8, w9 74 | mov w8, dummy1 75 | mov w9, dummy2 76 | 77 | ;---------------------------------------------- butterworth filtering 78 | mov #filter_I, w13 79 | mov #65, w11 80 | mov #131, w12 81 | call filter_2nd_order 82 | exch w8, w9 83 | mov #filter_Q, w13 84 | call filter_2nd_order 85 | exch w8, w9 86 | ;---------------------------------------------- send signals to motor 87 | mov #2048, w0 88 | add phi_hf_motor 89 | 90 | call write_motor_sinus 91 | 92 | ;---------------------------------------------- loop end, allow monitoring 93 | dec monitoring_count 94 | bra nz, igc_loop 95 | mov monitoring_value, w0 96 | mov w0, monitoring_count 97 | call monitoring 98 | bra igc_loop 99 | 100 | 101 | .bss 102 | monitoring_count: .space 2 103 | 104 | .end 105 | 106 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/throttle_open.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global throttle_open 6 | throttle_open: 7 | ;-------------------------------------- reverse pin as input, initialise direction to forward 8 | 9 | bset TRISF, #6 10 | bclr flags1, #reverse 11 | bclr flags1, #reverse_request 12 | 13 | ;-------------------------------------- select based on throttle mode 14 | 15 | btss flags_rom, #analog_throttle 16 | bra thop_no_analog_throttle 17 | 18 | ;-------------------------------------- initialise analog throttle 19 | ;initialise AN7 and AN8 20 | btss flags_rom, #throttle_AN7 21 | bra thop_skip_7 22 | bclr ADPCFG, #7 23 | bset TRISB, #7 24 | thop_skip_7: 25 | btss flags_rom, #throttle_AN8 26 | bra thop_skip_8 27 | bclr ADPCFG, #8 28 | bset TRISB, #8 29 | thop_skip_8: 30 | 31 | btsc flags_rom, #tx_throttle 32 | call CAN_open_TX 33 | 34 | bra thop_end 35 | 36 | ;-------------------------------------- initialise CAN_rx throttle 37 | thop_no_analog_throttle: 38 | 39 | call CAN_open_RX 40 | 41 | ;-------------------------------------- end 42 | thop_end: 43 | return 44 | 45 | ;*********************************************************** 46 | 47 | 48 | 49 | 50 | .end 51 | -------------------------------------------------------------------------------- /src/Lebowski_2A1/30F_powerstart_v2pA1.X/timers.s: -------------------------------------------------------------------------------- 1 | .include "p30F4011.inc" 2 | .include "defines.inc" 3 | 4 | .text 5 | .global timers_open 6 | timers_open: 7 | ;-------------------------------------- TMR1 for loop frequency 8 | 9 | bclr IEC0, #3 ;NO INTERRUPT ! 10 | mov #0b1000000000000000, w0 11 | mov w0, T1CON ;start TMR1, 1:1 pre-scale 12 | mov main_loop_count, w0 13 | mov w0, PR1 ;loopfreq = 30e6 / main_loop_count 14 | clr TMR1 15 | bclr IFS0, #3 16 | 17 | ;-------------------------------------- TMR2 for temperature measurement timings 18 | 19 | bclr IEC0, #6 ;no interrupts on TMR2 20 | clr TMR2 ;set count to 0 21 | mov #0b1000000000010000, w0 ;tmr2 on, 266.66 nsec/count 22 | mov w0, T2CON 23 | setm PR2 24 | 25 | ;-------------------------------------- TMR4 for throttle timing (when analog throttles are used) 26 | 27 | bclr IEC1, #5 ;no interrupts on TMR4 28 | clr TMR4 ;set count to 0 29 | mov #0b1000000000110000, w0 ;tmr4 on, 8.5usec/count 30 | mov w0, T4CON 31 | mov #1200, w0 ;once every 10 msec 32 | mov w0, PR4 33 | 34 | ;-------------------------------------- watchdog timer on when in motor mode and RX can (reset if no throttle within 48 msec) 35 | ;skip if analog throttle 36 | btsc flags_rom, #analog_throttle 37 | bra timers_end 38 | ;else turn on watchdog timer (motor mode only) 39 | clrwdt 40 | btsc flags1, #motor_mode 41 | bset RCON, #5 42 | 43 | ;-------------------------------------- end 44 | timers_end: 45 | return 46 | 47 | .end 48 | --------------------------------------------------------------------------------