Problem with PASD
ImmNek
Posts: 29
Hi,
I have a problem using the nice tool PASD V0.3.
When I load the following code into PASD the label "asm_fedge_pold" apears two times in the cogRAM view. How this can be? I'm confused, what do I make wrong?
Ful code:
I hope anybody can help me.
I have a problem using the nice tool PASD V0.3.
When I load the following code into PASD the label "asm_fedge_pold" apears two times in the cogRAM view. How this can be? I'm confused, what do I make wrong?
Ful code:
CON '*************************************************************************** 'clock settings _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 '******************************************************************************* VAR '*************************************************************************** long servo_en long servo_pw[noparse][[/noparse]32] '******************************************************************************* OBJ '*************************************************************************** Debug :"PasDebug" ServoOut :"Servo32v3" HW :"Hardware" '******************************************************************************* PUB Start : code '************************************************************** ServoOut.Set(HW.ELE_1_OUT, 1500) ServoOut.Set(HW.ELE_2_OUT, 1500) ServoOut.Set(HW.AIL_1_OUT, 1500) ServoOut.Set(HW.AIL_2_OUT, 1500) ServoOut.Set(HW.RUD_1_OUT, 1500) ServoOut.Set(HW.RUD_2_OUT, 1500) ServoOut.Set(HW.FLP_1_OUT, 1500) ServoOut.Set(HW.FLP_2_OUT, 1500) ServoOut.Start EnServo(HW.AIL_IN) EnServo(HW.ELE_IN) EnServo(HW.RUD_IN) EnServo(HW.FLP_IN) cognew(@asm_entry, @servo_en) code := Debug.start(31,30,@asm_entry) repeat '******************************************************************************* PUB EnServo(pin) '************************************************************** {{ ******************************************************************************** EnServo ******************************************************************************** DESCRIPTION This method enables a pin for measureming the servo signal. PARAMETERS ================================================================ pin |this is the signal pin ================================================================ RETURN void ******************************************************************************** }} pin := 0 #> pin <# 31 'limit the pin value servo_en |= 1 << pin 'enable the servo servo_pw[noparse][[/noparse]pin] := 0 'reset the pulse width '******************************************************************************* PUB DisServo(pin) '************************************************************* {{ ******************************************************************************** DisServo ******************************************************************************** DESCRIPTION This method stops the measurement on the defined pin. PARAMETERS ================================================================ pin |this is the signal pin ================================================================ RETURN void ******************************************************************************** }} pin := 0 #> pin <# 31 'limit the pin value servo_en &= !(1 << pin) 'disable the servo '******************************************************************************* PUB GetServoPW(pin) : width '*************************************************** {{ ******************************************************************************** GetServoPW ******************************************************************************** DESCRIPTION This method gets the pulse width of the defined measured signal. PARAMETERS ================================================================ pin |this is the signal pin ================================================================ RETURN This method returns the measured pulse width. ******************************************************************************** }} pin := 0 #> pin <# 31 'limit the pin value if servo_en & (1 << pin) 'check if this servo is enabled width := servo_pw[noparse][[/noparse]pin] 'get the pulse width else width := -1 'return error code '******************************************************************************* DAT '*************************************************************************** org 0 asm_entry ' --------- Debugger Kernel add this at Entry (Addr 0) --------- long $34FC1202,$6CE81201,$83C120B,$8BC0E0A,$E87C0E03,$8BC0E0A long $EC7C0E05,$A0BC1207,$5C7C0003,$5C7C0003,$7FFC,$7FF8 ' -------------------------------------------------------------- Entry rdlong asm_servo_en, par 'get the anabled servos mov asm_fedge_pold, asm_servo_en 'all servo pins from the enabled servos are high mov asm_fedge_t_p, #asm_fedge_time 'set the array pointer to the first element (measured time) mov asm_fedge_p_p, #asm_fedge_pins 'set the array pointer to the first element (falling edge pins) mov asm_fedge_us, asm_us_1ms 'initialize the servo pulse width with the minimum of 1000us '------------------------------------------------------------------------------- 'wait for rising edge WaitREdge mov asm_data, ina 'get the input and asm_data, asm_servo_en wz 'check if there is a rising edge on an enabled servo if_z jmp #WaitREdge 'no rising edge --> repeat the procedure '------------------------------------------------------------------------------- mov asm_left_cyc, asm_clocks_1ms 'min. time for all negativ edges is 1ms sub asm_left_cyc, #48 '6 * 4 clock since the rising edge was at the pin '------------------------------------------------------------------------------- 'wait for 1ms WaitFor1ms or asm_data, ina 'or the input sub asm_left_cyc, #16 'subtract 12 clocks for this three instructions cmp asm_left_cyc, #16 wc 'check if one ms is achieved if_nc jmp #WaitFor1ms '------------------------------------------------------------------------------- 'get the enabled servos with no signal and remove them from the measurement CheckNoSignal mov asm_no_sig_pin, asm_FFFF_FFFF 'load register for inverting andn asm_no_sig_pin, asm_data 'invert the measured input and asm_no_sig_pin, asm_servo_en 'get only the bad signals on the enabled pins andn asm_fedge_pold, asm_no_sig_pin 'delete servos with no signals '------------------------------------------------------------------------------- nop 'wait 4 clocks nop 'wait 4 clocks mov asm_data, asm_FFFF_FFFF 'initialize the asm_data for ina inverting '------------------------------------------------------------------------------- 'check if theres is a falling edge each microsecond at 80MHz CheckForFE andn asm_data, ina 'read the IO pins inverted and asm_data, asm_fedge_pold wz 'get all falling edges and check if there are any if_nz movd PArAdd1, asm_fedge_p_p 'set the adress of the current pin status array element PArAdd1 if_nz mov asm_fedge_pins, asm_data 'spare the pins with a falling edge in the array if_nz movd TArAdd1, asm_fedge_t_p 'set the adress of the current time array element TArAdd1 if_nz mov asm_fedge_time, asm_fedge_us 'spare the elapsed time since the positiv edge if_nz andn asm_fedge_pold, asm_data 'disable the servos with a falling edge if_nz add asm_fedge_t_p, #1 'get the next address of the time structure if_nz add asm_fedge_p_p, #1 'get the next address of the IO state structure nop 'wait 4 clocks nop 'wait 4 clocks nop 'wait 4 clocks nop 'wait 4 clocks nop 'wait 4 clocks nop 'wait 4 clocks nop 'wait 4 clocks mov asm_data, asm_FFFF_FFFF 'initialize the this register for inverted input add asm_fedge_us, #1 'add one microsecond (80 * (1 / 80_000_000MHz) = 1us) cmp asm_fedge_us, asm_us_2ms wc 'check if the time is not run out if_c jmp #CheckForFE 'check again for falling edge '------------------------------------------------------------------------------- 'clocks: 80 '80 * (1 / 80000000MHz) = 1us '------------------------------------------------------------------------------- cmp asm_fedge_pold, #0 wz 'check if all enabled servos have had an falling edge if_nz movd PArAdd3, asm_fedge_p_p 'set the correct address to the destination field (pin array) if_nz movd TArAdd3, asm_fedge_t_p 'set the correct address to the destination field (time array) PArAdd3 if_nz mov asm_fedge_pins, asm_fedge_pold 'set the falling edge for the left servos here (in cause of time is run out) TArAdd3 if_nz mov asm_fedge_time, asm_us_2ms 'set the time for the left servos to the maximum '------------------------------------------------------------------------------- mov asm_servo, #0 'initialize the actual servo with the LSB '------------------------------------------------------------------------------- 'get the next enabled servo GetNextEnServo mov asm_servo_bit, #1 shl asm_servo_bit, asm_servo 'calculate the bitmask for the actual servo and asm_servo_bit, asm_servo_en nr, wz 'check if on this bit is an enabled servo if_nz call #GetFEofServo add asm_servo, #1 'go to the next servo cmp asm_servo, #32 wc 'check if all servos are tested if_c jmp #GetNextEnServo 'not all enabled servos to the hubRAM written if_nc jmp #Entry 'no more enabled servos -> go to the program entry point '------------------------------------------------------------------------------- 'search the falling edge of the enabled servo GetFEofServo mov asm_fedge_t_p, #asm_no_sig_time 'set the array pointer to the no signal time mov asm_fedge_p_p, #asm_no_sig_pin 'set the array pointer to the no signal pins CheckPin movs PArAdd4, asm_fedge_p_p 'set the array pointer to the current array element PArAdd4 and asm_servo_bit, asm_fedge_pins nr, wz 'check if in this element is the falling edge of this servo if_z add asm_fedge_p_p, #1 'go to the next array element (pin array) if_z add asm_fedge_t_p, #1 'go to the next array element (time array) if_z jmp #CheckPin 'check the next array element for this servo '------------------------------------------------------------------------------- 'write the pulse length to the hubRAM WrPWhubRAM mov asm_data, asm_servo 'address in hubRAM: par + (servonumber + 1) * 4 add asm_data, #1 'add one long for the enabled servos parameters shl asm_data, #2 'multiply by 4 add asm_data, par 'add the hubRAM address of the first parameter movd TArAdd4, asm_fedge_t_p 'set the address of the array element TArAdd4 wrlong asm_fedge_time, asm_data 'write the servo width to the hubRAM GetFEofServo_ret ret '------------------------------------------------------------------------------- 'initalized data asm_FFFF_FFFF long $FFFF_FFFF 'used for inverting and for no signal time (-1) asm_no_sig_time long 0 asm_fedge_time long 0 'time of falling edge, initialize with zero long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 asm_no_sig_pin long 0 'servo pins without any signal asm_fedge_pins long 0 'pin state at falling edges, initialize with zero long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 long 0 asm_clocks_1ms long 80_000 'number of clock cycles in 1ms at 80MHz clock speed asm_us_1ms long 1_000 '1000 microseconds per millisecond asm_us_2ms long 2_000 '2000 microseconds in two milliseconds '------------------------------------------------------------------------------- 'memory reservation for uninitialized data asm_data res 1 'data buffer asm_servo_en res 1 'enabled servos (enabled bit is high and disabled bit is low) asm_left_cyc res 1 'left system clocks asm_fedge_us res 1 'number of achieved microseconds asm_fedge_t_p res 1 'pointer to a member of the falling edge time array asm_fedge_p_p res 1 'pointer to a member of the falling edge pin status asm_fedge_pold res 1 'last pin status asm_servo res 1 'actual servo (0..31) asm_servo_bit res 1 'actual servo's bitmask '------------------------------------------------------------------------------- fit '*******************************************************************************
I hope anybody can help me.
Comments
Here I have to code for you:
This is the code, but I don't think, that this file is the reason for this effect.
Greats from Switzerland,
Immanuel
Post Edited (ImmNek) : 11/24/2008 7:49:04 AM GMT
Without the "Hardware" object the compiler fails, and PASD can not show the cog ram and varibales.
If I eliminate the "Hardware" object and the according Spin lines, all seams to be OK in PASD.
Andy
I will send you a screenshot this evening.
Greats
Immanuel