View Single Post
Old Jan 17, 2011, 04:31 PM
richardkalaf is offline
Find More Posts by richardkalaf
Registered User
richardkalaf's Avatar
São Paulo,Brazil
Joined Jan 2011
148 Posts
Quote:
Originally Posted by SadSack View Post
only thing i know for sure. If input pulse order is wrong the output signal goes mad and if input channel is missing no output signal.

This could maybe help find channel order for your rx
A logic analyzer using the PC's parallel port.

http://www.xs4all.nl/~jwasys/old/diy2.html
@SadSack and everyone else..

Well hereīs the ASM with the small modification i did commenting 2 lines (in RED) to make it a 5-channel . I hope i got this right.


Code:
; Atmel Win32 AVR Disassembler V1.01 by SXPILOT450
          ; Byte Address & ASCII Column by WagnerLip - 2009
          ;
          ; Instruction         ADDR HEXA OPERANDS     BYTE#  ASCII NEXT 8 
          ; ------------------  ---- ---- --------     ----  ----------------
          ;

	  ; Modified by Druzara/Rex 09/22/2009
	  ; http://acholic.turningaway.net
          ;
	  ; 6 Channel operation for Spektrum 6xxx receivers
	  ; PPM output on PB7, inputs on PB0-PB5
          ; AT90S2313 8MHz
          ; changes to original code are commented out but left in source


         .DEVICE AT90S2313
         .INCLUDE "2313def.inc"
         .cseg
         .org	0



          ldi    r23, 0x9F    ; 0000 E97F              0000   Setup stack pointer
          out    SPL, r23     ; 0001 BF7D              0002   
;         sbi    DDRB, 4      ; 0002 9ABC              0004   PB4 as ppm output
          sbi    DDRB, 7      ;                        0004   PB7 as ppm output

avr0003:  ldi    r22, 0x01    ; 0003 E061              0006   load r22 with bit to test
          rcall  avr0015      ; 0004 D010              0008   call avr0015 to set output
          ldi    r22, 0x02    ; 0005 E062              000A   repeat for all bits
          rcall  avr0015      ; 0006 D00E              000C   
          ldi    r22, 0x04    ; 0007 E064              000E   
          rcall  avr0015      ; 0008 D00C              0010   
          ldi    r22, 0x08    ; 0009 E068              0012  
          rcall  avr0015      ; 000A D00A              0014   
;         ldi    r22, 0x20    ; 000B E260              0016   
          ldi    r22, 0x10    ; 000B E260              0016   
          rcall  avr0015      ; 000C D008              0018   
;         ldi    r22, 0x40    ; 000D E460              001A   
 ;        ldi    r22, 0x20    ; 000B E260              0016   
 ;        rcall  avr0015      ; 000E D006              001C   
;         ldi    r22, 0x80    ; 000F E860              001E   
;         rcall  avr0015      ; 0010 D004              0020   
;         sbi    PORTB, 4     ; 0011 9AC4              0022
          sbi    PORTB, 7     ; 0011 9AC4              0022   ppm out high
          rcall  avr001F      ; 0012 D00C              0024   short delay
;         cbi    PORTB, 4     ; 0013 98C4              0026
          cbi    PORTB, 7     ; 0013 98C4              0026   ppm out low
          rjmp   avr0003      ; 0014 CFEE              0028   loop for next cycle

avr0015:  in     r23, PINB    ; 0015 B376              002A   test PB bit masked
          and    r23, r22     ; 0016 2376              002C   by r22
          breq   avr0015      ; 0017 F3E9              002E   
;         sbi    PORTB, 4     ; 0018 9AC4              0030   
          sbi    PORTB, 7     ; 0018 9AC4              0030   set ppm out high
          rcall  avr001F      ; 0019 D005              0032   short delay to inject gap
;         cbi    PORTB, 4     ; 001A 98C4              0034   
          cbi    PORTB, 7     ; 0013 98C4              0026   ppm out low

avr001B:  in     r23, PINB    ; 001B B376              0036   wait until current
          and    r23, r22     ; 001C 2376              0038   channel is done
          brne   avr001B      ; 001D F7E9              003A   
          ret                 ; 001E 9508              003C   

avr001F:  ldi    r25, 0x03    ; 001F E093              003E   delay for proper gap between pulses
avr0020:  sbiw   r24, 0x01    ; 0020 9701              0040   ie: "needle" glitch as generated
          brne   avr0020      ; 0021 F7F1              0042       by diode circuits
          ret                 ; 0022 9508              0044   


          ori    r18, 0x38    ; 0023 6328              0046   '(c) 2006 R.Smith'
          and    r2, r9       ; 0024 2029              0048   ') 2006 R.Smith..'
          cpi    r19, 0x02    ; 0025 3032              004A   '2006 R.Smith....'
          cpi    r19, 0x60    ; 0026 3630              004C   '06 R.Smith......'
          subi   r18, 0x20    ; 0027 5220              004E   ' R.Smith........'
          subi   r18, 0x3E    ; 0028 532E              0050   '.Smith..........'
          ori    r22, 0x9D    ; 0029 696D              0052   'mith............'
          ori    r23, 0x84    ; 002A 6874              0054   'th..............'
                                                       
         .exit
The result is pretty much the same as before. Hereīs a video:

PPM 5ch to SUM channel Converter (0 min 33 sec)


Notice my problem. The scopeīs probe is connected to PB7 in an AT90S2313 with an 8Mhz XTAL, with that code on it.
I get that waveform independently if the Tx is ON or OFF, or if iīm flicking the sticks or not.

I have once again confirmed the sequence of my Rx signals on the scope. As i mentioned before, itīs AILE,ELEV,RUD,THRO,GEAR.

Iīve tried in this order, and reversing the order. Nothing changes.

What am i doing wrong? Do i need to set any fuse bit somewhere? I dinīt find where you set oscillator types and frequency in AVR Studio or anything, but i just copied and pasted the code from Druzara, wich seems to be running same uC and XTAL as i am..
Iīm using PROGISP to burn the chip, but also tried AVRDUDE with same results.

Iīve tried before:

-The diodes approach > Well at least i get a signal that resembles a square wave, bout itīs all messed up.

-The HCF4078BEY Approach. I didnīt find a schematic anywhere so i just plugged all channels on the inputs and the output on the well..output, following the datasheet. > Again, crazy output that doesnīt seem to change if i flick the sticks, and spikes all over the place.

uhm... help?
richardkalaf is offline Find More Posts by richardkalaf
Reply With Quote