R/C MIXer  FOR DLETA WIND & V-TAIL

VERSION 1.0 (MAY/03/2004)

 

This firmware mixes two servo signals to produce sum and difference signals. 

Input signals are pulse trains repeated at 20mS intervals. Each pulse is nominally 1.5mS +/- 0.5ms. the neutral position correspond to pulse width 1.5 mS

Mixing ChY with ChX, a proportion of ChY is bi-directionally mixed with ChX, 

        ΔChA = (q(Δ ChX) + r(Δ ChY))

        ΔChB = (q(Δ ChX) - r(ΔChY))

Where Δ means deviation from neutral position 

q & r are the mixing ratio, a number of 0.5 or 1

configuration

Jumper1

Jump2 

q

r

1 (default)

OFF

 OFF

1

1

2

OFF

ON

1

0.5

3

ON

OFF

0.5

1

4

ON

ON

0.5

0.5

 

The firmware defind 10 uS as one unit,  a normal PWM pulse  vary from 100 to 200 units. the neutral position is 150 units.  Δ ChX = ChX-150,  Δ ChY = ChY-150.

 Configuration 1:

ChA =150+ Δ ChX + Δ ChY      = ChX + ChY-150        =(ChX-50) +( ChY-100)

ChB =150+ Δ ChX - ΔChY        = ChX – (ChY-150)      =(ChX+50) - ( ChY-100)

 

Configuration 2:

ChA =150+ Δ ChX + (Δ ChY/2)        =(ChX-25) +(( ChY-100)/2)

ChB =150+ Δ ChX – (Δ ChY/2)        =(ChX+25) - (( ChY-100)/2)

 

Configuration 3:

ChA =150+ (Δ ChX/2) +Δ ChY         =75+((ChX-100)/2) +( ChY-100)

ChB =150+ (Δ ChX /2)–Δ ChY          =175+((ChX-100)/2) – ( ChY-100)

 

Configuration 4:

ChA =150+ (Δ ChX/2) + (Δ ChY/2)   =(ChX/2) + (ChY/2)

ChB =150+ (Δ ChX/2) – (Δ ChY/2)    =(150+ ChX/2) - (ChY/2)

 

After transform, all the operands will less than 255 decimal, and all number are plus sign, convenient for one byte calculation.

 

==============================================

(read ASM file for more details)

First part of the program is to determine, which channel is precedence over the other in the transmitting frame.

The duration between the first coming and the secondary may only 2 mS, and between the secondary and next frame may as long as 115 mS, after receive pulse from two channels, the microprocessor need about 5 mS to calculate & deliver ChA & ChB. we want the calculate & deliver job doing at period between the secondary and next frame coming.

# Who (in=pin2, pin3, noise, t1 ;; out= ;;temp=tmr1, tmr2)

-------------------------------------------------------------------------------

The second part is to read the width (units) of input pulses, filter pulses may be noise (less than VAR noise) and to restrict the values between 100~200 

# Read (in= pin2, pin3,  noise ;; out=x1, y1 ;; temp=tmr1)

-------------------------------------------------------------------------------

Next is to calculate the pulse width should be output, depend on q , r. 

# Calc (in=x1, y1, q, r ;; out =ChA, ChB, ;;temp = XX, YY) 

--------------------------------------------------------------------------------

Finally, restrict the values between 100~200, use 10 uS loop (same as read in) to convert the units to PWM pulses

# Output (in=ChA, ChB ;; out =pin4, pin5 ;;temp = tmr1)

===============================================

BACK

====================================================================================== 

You can duplicate, modify, give away or sell the original files in the web site or anything you derive from it.

ATTENTION : It is your own responsibility, if any damage cause by using the web site.

Philip Sun / TAIWAN

ilufa@yahoo.com

copy right 2004

 

Free Web Hosting