|
|
|
|
||
|
|
Quote:
|
|
|
||
|
|
|
|
|
|
|
Anybody any experience with this interface on a Spektrum AR7000 (or any other receiver with servo sync)?
|
|
|
|
|
|
|
|
Would this 8CH GWS-8M 35mhz FM receiver be hackable to take a direct PPM in put and give me the servo pwm outputs?
|
|
|
|
|
|
|
NW England
Joined Jul 2005
620 Posts
|
EDIT - Atmega8 does in fact have 8 pins in PORTB... I didn't look hard enough
So ignore thisThanks for the code! I've got an atmega8 lying around so I'd like to use this to sum 6 channels. I've not clue about assembly but have made the changes to the code to try to do this : 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 C0, inputs on PB0-PB5
; ATMEGA8 8MHz
; changes to original code are commented out but left in source
;.DEVICE AT90S2313
.INCLUDE "m8def.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 DDRC, 0 ; 0004 PC0 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 PORTC, 0 ; 0011 9AC4 0022 ppm out high
rcall avr001F ; 0012 D00C 0024 short delay
; cbi PORTB, 4 ; 0013 98C4 0026
cbi PORTC, 0 ; 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 PORTC, 0 ; 0018 9AC4 0030 set ppm out high
rcall avr001F ; 0019 D005 0032 short delay to inject gap
; cbi PORTB, 4 ; 001A 98C4 0034
cbi PORTC, 0 ; 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
Thanks! Ben. |
|
|
|
|
NW England
Joined Jul 2005
620 Posts
|
Thanks beer-man... I've looked through the code and with the help of Lord Google I've figured out what it's doing. Unfortunately though I think I've bricked my atmega8 as the programmer can't find it's signature now (it's all Fs). I was attempting to set the fuse bits but my lack of knowledge killed it
![]() Ben. |
|
|
|
|
||
|
|
Quote:
thanks, Bendin |
|
|
||
|
|
|
|
hungary
Joined Jan 2011
110 Posts
|
Hi,
I made my own PWM2PPM converter based on ATtiny2313. Mine can handle up to 8 channels (it uses the entire port B of the ATtiny2313) and I have a power LED and a PWM signal indicator LED. I have also added 4 pull-down resistors for channels 4-8 to avoid any problems with floating inputs. This can only handle PWM pulses which are not simultaneous - the pulses may not overlap; they have to occur one after another. The source code is written in C. I used the 8 bit timer interrupt to generate the 300us PPM pulse, but I think a delay_us(300) could be used instead just as well. I also thought about using pin change interrupts instead of polling, but I think polling makes things a little simpler. As I said, the program can handle any number of channels (up to 8), but I don't recommend less than 4 because only channels 4-8 have the pull-downs. I have attached the Eagle CAD schematic and PCB. I made the circuit and PCB so that I can plug my receiver directly into the converter. I have tested it with a HK6DF TX/RX and I use it for controlling a simulator. It seems to work just fine. Enjoy! |
|
|
|
|
|
|
Joined Jan 2012
1 Posts
|
Hello,
I don't mean to revive an old thread but I was wondering if anyone could maybe modify the code for three channels with a ATTiny13A. I am trying to include this as a method to transmit data over some distance via cable. Except I only need the three channels. Thank you, any help is much appreciated. I will try and understand it as best i can in the meantime. I am more mechanically inclined, software is a foreign language to me. Andrew |
|
|
|
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Discussion how to convert PWM servo signal to DC voltage | sahilkit | DIY Electronics | 15 | Oct 05, 2008 09:23 PM |
| Mini-HowTo Motor PWM to PPM impulse converter | quax | DIY Electronics | 27 | Jun 16, 2008 11:38 PM |
| PWM to servo signal conversion? | mcross | DIY Electronics | 13 | Jul 05, 2005 08:48 PM |
| Futaba PCM receiver servo pulse other than PPM? | risto | Power Systems | 14 | Feb 14, 2002 12:18 PM |