Problem with PASD
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:
{{ ******************************************************************************** FILE Hardware.spin ******************************************************************************** AUTHOR Immanuel Nekvasil / Manuel Metz COMPANY HCU Engineering Team DATE Monday, 17th November 2008 VERSION 0.1 DESCRIPTION This is object contains al hardware related definitions and method to handle the hardware. ******************************************************************************** HISTORY Monday, 17th November 2008 (by I. Nekvasil): -> created this file -> added the method AIL_IN and it's documentation -> added the method ELE_IN and it's documentation -> added the method RUD_IN and it's documentation -> added the method FLP_IN and it's documentation -> added the method ELE_OUT_1 and it's documentation -> added the method ELE_OUT_2 and it's documentation -> added the method AIL_OUT_1 and it's documentation -> added the method AIL_OUT_2 and it's documentation -> added the method RUD_OUT_1 and it's documentation -> added the method RUD_OUT_2 and it's documentation -> added the method FLP_OUT_1 and it's documentation -> added the method FLP_OUT_2 and it's documentation Saturday, 22nd November 2008 (by I. Nekvasil): -> added the method THRUST_IN and it's documentation -> added the method ADJUST_1_IN and it's documentation -> added the method ADJUST_2_IN and it's documentation -> added the method ADJUST_3_IN and it's documentation -> added the method LED_1_OUT and it's documentation -> added the method LED_2_OUT and it's documentation -> added the method SPI_CLK_INOUT and it's documentation -> added the method SPI_DOUT_OUT and it's documentation -> added the method GYRO_RST_OUT and it's documentation ******************************************************************************** }} CON '*************************************************************************** 'servo input signals AIL_IN_PIN = 27 'aileron input servo signal ELE_IN_PIN = 26 'elevator input servo signal RUD_IN_PIN = 25 'rudder input servo signal FLP_IN_PIN = 24 'flaps input servo signal 'servo output signals ELE_1_OUT_PIN = 0 'elevator 1 output signal ELE_2_OUT_PIN = 1 'elevator 2 output signal AIL_1_OUT_PIN = 2 'aileron 1 output signal AIL_2_OUT_PIN = 3 'aileron 2 output signal RUD_1_OUT_PIN = 4 'rudder 1 output signal RUD_2_OUT_PIN = 5 'rudder 2 output signal FLP_1_OUT_PIN = 6 'flaps 1 output signal FLP_2_OUT_PIN = 7 'flaps 2 output signal 'other input signals from the remote control THRUST_IN_PIN = 23 'thrust signal from the remote control ADJUST_1_IN_PIN = 22 'adjust signal 1 from the remote control ADJUST_2_IN_PIN = 21 'adjust signal 2 from the remote control ADJUST_3_IN_PIN = 20 'adjust signal 3 from the remote control 'LEDs (active high) LED_1_OUT_PIN = 13 'LED 1 LED_2_OUT_PIN = 12 'LED 2 'Serial Peripheral Interface SPI_CLK_INOUT_PIN = 11 'clock SPI_DIN_IN_PIN = 10 'digital input SPI_DOUT_OUT_PIN = 8 'digital output 'GYRO-sensor pins GYRO_RST_OUT_PIN = 9 'GYRO reset pin (active low) '******************************************************************************* PUB AIL_IN : pin '************************************************************** {{ ******************************************************************************** AIL_IN ******************************************************************************** DESCRIPTION This method returns the pin number of the input signal for the aileron. This is a servo signal. PARAMETERS void RETURN Pin of the aileron input signal. ******************************************************************************** }} pin := AIL_IN_PIN '******************************************************************************* PUB ELE_IN : pin '************************************************************** {{ ******************************************************************************** ELE_IN ******************************************************************************** DESCRIPTION This method returns the pin number of the input signal for the elevator. This is a servo signal. PARAMETERS void RETURN Pin of the elevator input signal. ******************************************************************************** }} pin := ELE_IN_PIN '******************************************************************************* PUB RUD_IN : pin '************************************************************** {{ ******************************************************************************** RUD_IN ******************************************************************************** DESCRIPTION This method returns the pin number of the input signal for the rudder. This is a servo signal. PARAMETERS void RETURN Pin of the rudder input signal. ******************************************************************************** }} pin := RUD_IN_PIN '******************************************************************************* PUB FLP_IN : pin '************************************************************** {{ ******************************************************************************** FLP_IN ******************************************************************************** DESCRIPTION This method returns the pin number of the input signal for the flap. This is a servo signal. PARAMETERS void RETURN Pin of the flap input signal. ******************************************************************************** }} pin := FLP_IN_PIN '******************************************************************************* PUB ELE_1_OUT : pin '*********************************************************** {{ ******************************************************************************** ELE_OUT_1 ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal for the elevator 1. This is a servo signal. PARAMETERS void RETURN Pin of the elevator 1 output signal. ******************************************************************************** }} pin := ELE_1_OUT_PIN '******************************************************************************* PUB ELE_2_OUT : pin '*********************************************************** {{ ******************************************************************************** ELE_OUT_2 ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal for the elevator 2. This is a servo signal. PARAMETERS void RETURN Pin of the elevator 2 output signal. ******************************************************************************** }} pin := ELE_2_OUT_PIN '******************************************************************************* PUB AIL_1_OUT : pin '*********************************************************** {{ ******************************************************************************** AIL_OUT_1 ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal for the aileron 1. This is a servo signal. PARAMETERS void RETURN Pin of the aileron 1 output signal. ******************************************************************************** }} pin := AIL_1_OUT_PIN '******************************************************************************* PUB AIL_2_OUT : pin '*********************************************************** {{ ******************************************************************************** AIL_OUT_2 ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal for the aileron 2. This is a servo signal. PARAMETERS void RETURN Pin of the aileron 2 output signal. ******************************************************************************** }} pin := AIL_2_OUT_PIN '******************************************************************************* PUB RUD_1_OUT : pin '*********************************************************** {{ ******************************************************************************** RUD_OUT_1 ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal for the rudder 1. This is a servo signal. PARAMETERS void RETURN Pin of the rudder 1 output signal. ******************************************************************************** }} pin := RUD_1_OUT_PIN '******************************************************************************* PUB RUD_2_OUT : pin '*********************************************************** {{ ******************************************************************************** RUD_OUT_2 ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal for the rudder 2. This is a servo signal. PARAMETERS void RETURN Pin of the rudder 2 output signal. ******************************************************************************** }} pin := RUD_2_OUT_PIN '******************************************************************************* PUB FLP_1_OUT : pin '*********************************************************** {{ ******************************************************************************** FLP_OUT_1 ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal for the flap 1. This is a servo signal. PARAMETERS void RETURN Pin of the flap 1 output signal. ******************************************************************************** }} pin := FLP_1_OUT_PIN '******************************************************************************* PUB FLP_2_OUT : pin '*********************************************************** {{ ******************************************************************************** FLP_OUT_2 ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal for the flap 2. This is a servo signal. PARAMETERS void RETURN Pin of the flap 2 output signal. ******************************************************************************** }} pin := FLP_2_OUT_PIN '******************************************************************************* PUB THRUST_IN : pin '*********************************************************** {{ ******************************************************************************** THRUST_IN ******************************************************************************** DESCRIPTION This method returns the pin number of the input signal thrust. This is a servo signal. PARAMETERS void RETURN Pin of the thrust input signal. ******************************************************************************** }} pin := THRUST_IN_PIN '******************************************************************************* PUB ADJUST_1_IN : pin '********************************************************* {{ ******************************************************************************** ADJUST_1_IN ******************************************************************************** DESCRIPTION This method returns the pin number of the input signal adjust 1. This is a servo signal. PARAMETERS void RETURN Pin of the adjust 1 input signal. ******************************************************************************** }} pin := ADJUST_1_IN_PIN '******************************************************************************* PUB ADJUST_2_IN : pin '********************************************************* {{ ******************************************************************************** ADJUST_2_IN ******************************************************************************** DESCRIPTION This method returns the pin number of the input signal adjust 2. This is a servo signal. PARAMETERS void RETURN Pin of the adjust 2 input signal. ******************************************************************************** }} pin := ADJUST_2_IN_PIN '******************************************************************************* PUB ADJUST_3_IN : pin '********************************************************* {{ ******************************************************************************** ADJUST_3_IN ******************************************************************************** DESCRIPTION This method returns the pin number of the input signal adjust 3. This is a servo signal. PARAMETERS void RETURN Pin of the adjust 3 input signal. ******************************************************************************** }} pin := ADJUST_3_IN_PIN '******************************************************************************* PUB LED_1_OUT : pin '*********************************************************** {{ ******************************************************************************** LED_1_OUT ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal LED 1. The LED is active high. PARAMETERS void RETURN Pin of the LED 1 output signal. ******************************************************************************** }} pin := LED_1_OUT '******************************************************************************* PUB LED_2_OUT : pin '*********************************************************** {{ ******************************************************************************** LED_2_OUT ******************************************************************************** DESCRIPTION This method returns the pin number of the output signal LED 2. The LED is active high. PARAMETERS void RETURN Pin of the LED 2 output signal. ******************************************************************************** }} pin := LED_1_OUT '******************************************************************************* PUB SPI_CLK_INOUT : pin '******************************************************* {{ ******************************************************************************** SPI_CLK_INOUT ******************************************************************************** DESCRIPTION This method returns the pin number of the SPI clock signal. PARAMETERS void RETURN Pin of the SPI clock signal. ******************************************************************************** }} pin := SPI_CLK_INOUT_PIN '******************************************************************************* PUB SPI_DIN_IN : pin '********************************************************** {{ ******************************************************************************** SPI_DIN_IN ******************************************************************************** DESCRIPTION This method returns the pin number of the SPI digital input signal. PARAMETERS void RETURN Pin of the SPI digital input signal. ******************************************************************************** }} pin := SPI_DIN_IN_PIN '******************************************************************************* PUB SPI_DOUT_OUT : pin '******************************************************** {{ ******************************************************************************** SPI_DOUT_OUT ******************************************************************************** DESCRIPTION This method returns the pin number of the SPI digital output signal. PARAMETERS void RETURN Pin of the SPI digital output signal. ******************************************************************************** }} pin := SPI_DOUT_OUT_PIN '******************************************************************************* PUB GYRO_RST_OUT : pin '******************************************************** {{ ******************************************************************************** GYRO_RST_OUT ******************************************************************************** DESCRIPTION This method returns the pin number of the reset signal for the GYRO, which is active low. PARAMETERS void RETURN Pin of the GYRO reset signal. ******************************************************************************** }} pin := GYRO_RST_OUT_PIN '*******************************************************************************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