HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Nov 14, 2011, 12:23 AM
Master of Flash
LazyZero's Avatar
Alsdorf/Eifel, Germany
Joined Jun 2005
1,546 Posts
Quote:
Originally Posted by LKJ View Post
Helo.
Got a old Atmega48P KKbord in a deal and want to play with it in a tri, the latest soft it vil accept is 1.5 or 1.6
Now 1,6 have faster update rate to the ESCes, can 1.6 be used with Turnigy Plush ESC or do i need to back off to 1.5 annyone know.
Thanks in advance.
Lars.
The Plush normally work with the 1.6.

Quote:
Originally Posted by ScooterInVegas View Post
Can some one explain to me to differences between the different KK boards out there? How many different boards are there. Im a newbie and bought the Flycam Blackboard. It flys great, but I know nothing about tuning it. Is there a GUI type interface to adj the PID's?

Why is there SO many boards with KK in the name!!
To irritate you a bit more. The FLYCAM blackboard is not a kk board. The kk formware will not run on this board, only flycam firmware can be used.

The rest of the available kk boards differ only some additional features that are only available with one variation of the kk firmware.

Christian
LazyZero is online now Find More Posts by LazyZero
Reply With Quote
Sign up now
to remove ads between posts
Old Nov 14, 2011, 12:44 AM
Village Idiot!
ScooterInVegas's Avatar
United States, NV, Las Vegas
Joined Apr 2011
1,932 Posts
Quote:
Originally Posted by LazyZero View Post
To irritate you a bit more. The FLYCAM blackboard is not a kk board.
I figured that out AFTER buying the Flycam. The KK in "MultiCopters" made me think it was related in some way or another. I thought maybe Minsoo Kim was licensing board design and using his own FW or something. Ive since moved on to other boards but am still confused about all the KK's. To be more specific, whats the story behind them having the same URL except the Kr and Com and both having "black boards"?

I think I know the answer to that one.

My flycam is in a drawer , replaced with a CC.

Thanks
ScooterInVegas is offline Find More Posts by ScooterInVegas
Last edited by ScooterInVegas; Nov 14, 2011 at 01:21 AM.
Reply With Quote
Old Nov 14, 2011, 01:17 AM
Master of Flash
LazyZero's Avatar
Alsdorf/Eifel, Germany
Joined Jun 2005
1,546 Posts
Minsoo build in the past kk boards, which where compatible to the kkmulticopter blackboard from Jussi. But he changed a bit and did the mistake to call his new product blackboard. That lead to much confusion.

Christian
LazyZero is online now Find More Posts by LazyZero
Reply With Quote
Old Nov 14, 2011, 02:13 PM
LKJ
Lars k Jensen
Denmark, Central Denmark Region, Tostrup
Joined Apr 2006
536 Posts
Quote:
Originally Posted by LazyZero View Post
The Plush normally work with the 1.6.


Christian
Thanks.
Lars.
LKJ is offline Find More Posts by LKJ
Reply With Quote
Old Nov 15, 2011, 03:29 AM
Registered User
Joined Nov 2011
2 Posts
VTOL thingy

Quote:
Originally Posted by kapteinkuk View Post
Here is my my take on the Single Propeller VTOL thingy. This was started some time ago, long before I saw Minsoo's SP VTOL

M1: Front servo
M2: Left servo
M3: Right servo
M4: Rear servo

ESC is directly connected to the RX.
Connect the throttle cable from the KK board to an unused channel or connect the signal wire to the ground.

Here is a video from the first test:

http://www.youtube.com/watch?v=pJzXUAibRo4


EDIT:
Servos: HXT900
Motor: DT-750
prop: GWS 12x6 slowflyer
batteries: 2 x 1.8Ah 3S
weight without batteries: 495g

It is a quick hack of wood spatulas, zip ties, tape, CD control horns, hot glue, depron and one 1.5l plastic bottle.
I am going to make a better one later.
Dear KapteinKUK
I dont understand it.
Please can give me schema rx to kkboard to esc to motor to servos
fantom1951 is offline Find More Posts by fantom1951
Reply With Quote
Old Nov 16, 2011, 03:41 AM
Registered User
Joined Nov 2011
2 Posts
Quote:
Originally Posted by culexus View Post
Nice!! Maby the kapteinkuk him self should look into the firware part?
I have hk board. I want make to singleprop vtol.Please can you send me connection schema?Thanks
fantom1951 is offline Find More Posts by fantom1951
Reply With Quote
Old Nov 17, 2011, 01:19 AM
Registered User
Joined Apr 2008
269 Posts
Hi all
the KK and Flycam firmware has been updated with v2.4.
1.Fixed the bug that dose not armed for some of Rx.
2.If the Rx is dropped in flying, set the center of the stick.
please download v2.4 http://www.kkmulticopter.kr/

Thanks
Minsoo
Minsoo Kim is offline Find More Posts by Minsoo Kim
Last edited by Minsoo Kim; Nov 17, 2011 at 07:48 PM.
Reply With Quote
Old Nov 17, 2011, 06:39 AM
Registered User
Украина, Запорожская область, Запорожье
Joined Jun 2011
18 Posts
thank you. Good job.I did tests already.
sovit is offline Find More Posts by sovit
Reply With Quote
Old Nov 17, 2011, 07:09 AM
Registered User
Austria
Joined Jan 2004
7,234 Posts
Guys ...

Finally I got my programming USB cable for the KK board.

No instruction included ...

Can anybody tell me what is for the jumper ?

This is J2 on the USB-board.

Thanks

e_lm_70
e_lm_70 is offline Find More Posts by e_lm_70
Reply With Quote
Old Nov 17, 2011, 07:57 AM
Registered User
Nederland, NB, Breda
Joined Aug 2011
41 Posts
Quote:
Originally Posted by Minsoo Kim View Post
Hi all
the firmware has been updated with v2.4.
1.Fixed the bug that dose not armed for some of Rx.
2.If the Rx is dropped in flying, set the center of the stick.
please download v2.4 http://www.kkmulticopter.kr/

Thanks
Minsoo
Hi Minsoo. What advantage has your firmware in relation to the KK 4.7 firmware?
Dr.Gonzo is offline Find More Posts by Dr.Gonzo
Reply With Quote
Old Nov 17, 2011, 08:02 AM
Registered User
Joined Aug 2011
35 Posts
I want to have stabilizer for my plane. Is it easier to modify that single vtol or earlier quad copter code for this?

Would something like this work:



Code:
.include "m48def.inc"

;---  16.16 bit signed registers ---

.equ	Temp				=0

.equ	RxInRoll			=1
.equ	RxInPitch			=2
.equ	RxInYaw				=3
.equ	RxInCollective			=4

.equ	RxChannel			=5

.equ	GyroZeroRoll			=9
.equ	GyroZeroPitch			=10
.equ	GyroZeroYaw			=11

.equ	ServoOut1			=12
.equ	ServoOut2			=13
.equ	ServoOut3			=14
.equ	ServoOut4			=15

.equ	GyroRoll			=17
.equ	GyroPitch			=18
.equ	GyroYaw				=19

.equ	GainInRoll			=26
.equ	GainInPitch			=27
.equ	GainInYaw			=28

.equ	GyroCheck			=29


.equ	B16_RegAdd=0x0100	;base address for the math library register array

.equ	B16_WorkAdd=0x0200	;base address for the math library work area


.def	RxChannel1StartL	=r0
.def	RxChannel1StartH	=r1

.def	RxChannel2StartL	=r2
.def	RxChannel2StartH	=r3

.def	RxChannel3StartL	=r4
.def	RxChannel3StartH	=r5
	
.def	RxChannel4StartL	=r6
.def	RxChannel4StartH	=r7

.def	RxChannel1L		=r8
.def	RxChannel1H		=r9

.def	RxChannel2L		=r10
.def	RxChannel2H		=r11

.def	RxChannel3L		=r12
.def	RxChannel3H		=r13

.def	RxChannel4L		=r14
.def	RxChannel4H		=r15



.equ 	FlagGyroCalibrated=b16_workadd+24


.def	t=r16				;Main temporary register

;r16,r17,r18,r19 is destroyed by the math lib


.def	counterl=r20
.def	counterh=r21

.def	RxChannelsUpdatingFlag=r22	;ISR (do not read channels while this is true) 

.def	tisp=r23			;ISR temporary register

					;the registers marked ISR is not to be used for any other purpose 

	


.macro led0_on			;macros for the LED's
	sbi portb,6
.endmacro
.macro led0_off
	cbi portb,6
.endmacro
.macro led2_on
	sbi portd,5
.endmacro
.macro led2_off
	cbi portd,5
.endmacro
.macro led3_on
	sbi portd,6
.endmacro
.macro led3_off
	cbi portd,6
.endmacro



#define Servo_out_pin_1 portb,2	;Servo output pin assignments
#define Servo_out_pin_2 portb,1
#define Servo_out_pin_3 portb,0
#define Servo_out_pin_4 portd,7


.include "1616mathlib_ram_macros_v1.asm"

.org 0


	rjmp reset
	rjmp RxChannel2
	rjmp RxChannel3
	rjmp RxChannel4
	rjmp unused
	rjmp RxChannel1
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused
	rjmp unused


unused:	reti

reset:	ldi t,low(ramend)	;initalize stack pointer
	out spl,t
	ldi t,high(ramend)
	out sph,t

	
;--- setup IO ---

	;       76543210
	ldi t,0b01111111
	out ddrb,t

	;       76543210
	ldi t,0b11000000
	out ddrc,t
	
	;       76543210
	ldi t,0b11110001
	out ddrd,t


;--- Setup pin change interrupt on PD1, PD2, PD3, PB4

	;       76543210
	ldi t,0b00000101	;PB7, PB1
	sts pcicr,t

	;       76543210	
	ldi t,0b10000000	;PB7
	sts pcmsk0,t
	
	;       76543210
	ldi t,0b00000010	;PD1
	sts pcmsk2,t


	;       76543210
	ldi t,0b00000101	;PD2, PD3
	sts eicra,t
	

	;       76543210
	ldi t,0b00000011	;PD2, PD3
	out eimsk,t		;STS? OUT?  Come on!



;---- Setup timer1 to run at 1MHz ----

	;       76543210
	ldi t,0b00000010
	sts tccr1b,t


;---- Initalize variables ---

	clr t
	sts FlagGyroCalibrated,t	;FlagGyroCalibrated = false	

	ldi xl,low(1520)		;prime the channels
	ldi xh,high(1520)

	mov RxChannel1L,xl
	mov RxChannel1H,xh
	mov RxChannel2L,xl
	mov RxChannel2H,xh
	mov RxChannel3L,xl
	mov RxChannel3H,xh
	mov RxChannel4L,xl
	mov RxChannel4H,xh



;----
	sei

	led0_off


	rjmp ma1


ca1: ;Initialize calibration measurement.

	b16ldi Temp, 0	
	b16mov GyroZeroRoll, Temp
	b16mov GyroZeroPitch, Temp
	b16mov GyroZeroYaw, Temp
	ldi counterl,20

ca2: rcall ReadGyros ;Make calibration measurement (average of 20 sample)

	b16add GyroZeroRoll, GyroRoll
	b16add GyroZeroPitch, GyroPitch
	b16add GyroZeroYaw, GyroYaw
	dec counterl
	brne ca2

	b16ldi Temp, 20
	b16div GyroZeroRoll, Temp
	b16div GyroZeroPitch, Temp
	b16div GyroZeroYaw, Temp

	ldi counterl,20



	;--- Main loop ---



ma1:	
	rcall ReadGainPots
	rcall RxGetChannels
	rcall ReadGyros

	lds t, FlagGyroCalibrated		;turn off gain if gyros not calibrated
	tst t
	brne ma3

ma2:	b16ldi Temp, 0				;set GAIN to zero
	b16mov GainInRoll,Temp
	b16mov GainInYaw,Temp
	b16mov GainInPitch,Temp

ma3:	

	b16sub GyroRoll, GyroZeroRoll			;remove offset from gyro output
	b16sub GyroPitch, GyroZeroPitch
	b16sub GyroYaw, GyroZeroYaw

	;--- Start by setting servos to center ---

	b16ldi Temp, 50
	b16mov ServoOut1, Temp
	b16mov ServoOut2, Temp
	b16mov ServoOut3, Temp
	b16mov ServoOut4, Temp

	; --- Add flaperon mix ---

	b16add ServoOut1, RxInCollective
	b16add ServoOut2, RxInCollective

	;--- Calculate roll gyro output ---

	b16ldi Temp, -0.002				;roll gyro gain scaling, make negative to reverse gyro direction.
	b16mul Temp, GainInRoll
	b16mul GyroRoll, Temp				
	
	b16ldi Temp, 0.5				;scale stick output
	b16mul RxInRoll, Temp	

	b16add RxInRoll, GyroRoll			;add gyro output to stick output
	
	;--- Add roll gyro output to Servo 2 and 3 ---

	b16add ServoOut1, RxInRoll
	b16sub ServoOut2, RxInRoll

	;--- Calculate pitch gyro output ---

	b16ldi Temp, -0.002				;pitch gyro gain scaling, make negative to reverse gyro direction.
	b16mul Temp, GainInPitch
	b16mul GyroPitch, Temp				
	
	b16ldi Temp, 0.5				;scale stick output
	b16mul RxInPitch, Temp	

	b16add RxInPitch, GyroPitch			;add gyro output to stick output
	
	
	;--- Add pitch gyro output to Servo 4 ---

	b16add ServoOut4, RxInPitch

	;--- Calculate yaw gyro output ---

	b16ldi Temp, -0.001				;yaw gyro gain scaling, make negative to reverse gyro direction.
	b16mul Temp, GainInYaw
	b16mul GyroYaw, Temp				
	
	b16ldi Temp, 0.5				;scale stick output
	b16mul RxInYaw, Temp	

	b16add RxInYaw, GyroYaw				;add gyro output to stick output
	
	;--- Add yaw gyro output to Servo 3 ---

	b16add ServoOut3, RxInYaw
	

	;--- Output to Servo ---

	rcall output_Servo_ppm

ca3:	

	lds t, FlagGyroCalibrated		; check cal if gyros not calibrated
	tst t
	brne ma1						; if ok -> main loop

	ldi counterl,20

ca4: rcall ReadGyros ;Check gyro calib for roll axis

	b16add GyroCheck, GyroRoll
	dec counterl
	brne ca4

	b16ldi Temp, 20
	b16div GyroCheck, Temp
	b16sub GyroCheck, GyroZeroRoll

	b16ldi Temp, 1	
	b16cmp GyroCheck, Temp
	brge ca1 ; If too big error -> make another calibration

	ldi counterl,20

ca5: rcall ReadGyros ; Check gyro calib for yaw axis

	b16add GyroCheck, GyroYaw
	dec counterl
	brne ca5

	b16ldi Temp, 20
	b16div GyroCheck, Temp
	b16sub GyroCheck, GyroYawRoll

	b16ldi Temp, 1	
	b16cmp GyroCheck, Temp
	brge ca1 ; If too big error -> make another calib

	ldi counterl,20

ca6: rcall ReadGyros ; Check gyro calib for pitch axis

	b16add GyroCheck, GyroPitch
	dec counterl
	brne ca6

	b16ldi Temp, 20
	b16div GyroCheck, Temp
	b16sub GyroCheck, GyroPitchRoll

	b16ldi Temp, 1	
	b16cmp GyroCheck, Temp
	brge ca1 ;Error too big?

	; No. Calib ok -> main loop with gyro gain from pots

ca7: 

	ser t
	sts FlagGyroCalibrated,t	;FlagGyroCalibrated = true	
	led0_on				;turn on "ready for flight" led

	rjmp ma1						; Back to loop - calib ok

	;--- End of main loop ---


	;--- Subroutines ---


	;--- Output Servo ppm channels 1-4 in parallell ---
	; Input is 0 to 100

output_Servo_ppm:

	b16ldi Temp, 0			;limit to zero
	b16cmp ServoOut1,Temp
	brge ou1
	b16mov ServoOut1,Temp
ou1:
	b16cmp ServoOut2,Temp
	brge ou2
	b16mov ServoOut2,Temp
ou2:
	b16cmp ServoOut3,Temp
	brge ou3
	b16mov ServoOut3,Temp
ou3:
	b16cmp ServoOut4,Temp
	brge ou4
	b16mov ServoOut4,Temp
ou4:

	b16ldi Temp, 100		;limit to 100
	b16cmp ServoOut1,Temp
	brlt ou5
	b16mov ServoOut1,Temp
ou5:
	b16cmp ServoOut2,Temp
	brlt ou6
	b16mov ServoOut2,Temp
ou6:
	b16cmp ServoOut3,Temp
	brlt ou7
	b16mov ServoOut3,Temp
ou7:
	b16cmp ServoOut4,Temp
	brlt ou8
	b16mov ServoOut4,Temp
ou8:

	
	b16ldi Temp, 100		;add 1ms to all channels
	b16add ServoOut1,Temp
	b16add ServoOut2,Temp
	b16add ServoOut3,Temp
	b16add ServoOut4,Temp


	b16load ServoOut1		;scale from 0-200 to 0-800 (multiply by 4)
	ldi t,2
	rcall FastMultiply
	b16store ServoOut1

	b16load ServoOut2
	ldi t,2
	rcall FastMultiply
	b16store ServoOut2

	b16load ServoOut3
	ldi t,2
	rcall FastMultiply
	b16store ServoOut3

	b16load ServoOut4
	ldi t,2
	rcall FastMultiply
	b16store ServoOut4


	b16load ServoOut4		;transfer to 16bit counters
	push xl
	push xh
	b16load ServoOut3		
	push xl
	push xh
	b16load ServoOut2		
	push xl
	push xh
	b16load ServoOut1		
	movw r25:r24,xh:xl

	pop r27
	pop r26

	pop r29
	pop r28

	pop r31
	pop r30

	sbi Servo_out_pin_1		;turn on pins
	sbi Servo_out_pin_2
	sbi Servo_out_pin_3
	sbi Servo_out_pin_4

	clr t

	ldi counterl,low(801)
	ldi counterh,high(801)


ou13:	subi r24,1			;20 cycles (1ms = 400 counts)
	sbc r25,t
	brcc ou9
	cbi Servo_out_pin_1
ou9:	
	subi r26,1
	sbc r27,t
	brcc ou10
	cbi Servo_out_pin_2
ou10:
	subi r28,1
	sbc r29,t
	brcc ou11
	cbi Servo_out_pin_3
ou11:	
	subi r30,1
	sbc r31,t
	brcc ou12
	cbi Servo_out_pin_4
ou12:	
	subi counterl,1
	sbc counterh,t
	brcc ou13

	ret	





	;--- Read ADC's ---

ReadGyros:
	;       76543210
	ldi t,0b00111111
	sts didr0,t

	;       76543210
	ldi t,0b00000000
	sts adcsrb,t


	;       76543210	;read roll
	ldi t,0b00000010
	rcall read_adc
	b16store GyroRoll

	;       76543210	;read pitch
	ldi t,0b00000001
	rcall read_adc
	b16store GyroPitch

	;       76543210	;read yaw
	ldi t,0b00000000
	rcall read_adc
	b16store GyroYaw

	ret



ReadGainPots:
	;       76543210
	ldi t,0b00111111
	sts didr0,t

	;       76543210
	ldi t,0b00000000
	sts adcsrb,t


	;       76543210	;read roll gain
	ldi t,0b00000011
	rcall read_adc
	b16store GainInRoll

	;       76543210	;read pitch gain
	ldi t,0b00000100
	rcall read_adc
	b16store GainInPitch

	;       76543210	;read yaw gain
	ldi t,0b00000101
	rcall read_adc
	b16store GainInYaw
	
	ret



read_adc:			;x = adc    y = 0
;led2_on
	sts admux,t		;set ADC channel
	;       76543210
	ldi t,0b11000110	;start ADC
	sts adcsra,t

re1:	lds t,adcsra		;wait for ADC to complete
	sbrc t,6
	rjmp re1

	lds xl,adcl		;read ADC
	lds xh,adch

	clr yl
	clr yh
;led2_off
	ret






waitms:			;wait zl * 0.1ms
	ldi t,199
wa1:	nop
	dec t
	brne wa1
	dec zl
	brne waitms
	ret





	;--- Read RX channels 1-4, pin change interrupt driven ---
	;these have to be fast as possible to minimize jitter in loop timed events

RxChannel1:
;led2_on
	ser RxChannelsUpdatingFlag

	in tisp, sreg

	sbis pind,1				;rising or falling?
	rjmp rx1m1


	lds RxChannel1StartL, tcnt1l		;rising, store the start value
	lds RxChannel1StartH, tcnt1h

	clr RxChannelsUpdatingFlag

	out sreg,tisp				;exit	
;led2_off
	reti


rx1m1:	lds RxChannel1L, tcnt1l			;falling, calculate the pulse length
	lds RxChannel1H, tcnt1h

	sub RxChannel1L, RxChannel1StartL
	sbc RxChannel1H, RxChannel1StartH

	clr RxChannelsUpdatingFlag

	out sreg,tisp				;exit	
;led2_off
	reti


RxChannel2:
;led2_on
	ser RxChannelsUpdatingFlag

	in tisp, sreg

	sbis pind,2				;rising or falling?
	rjmp rx2m1


	lds RxChannel2StartL, tcnt1l		;rising, store the start value
	lds RxChannel2StartH, tcnt1h

	clr RxChannelsUpdatingFlag

	out sreg,tisp				;exit	
;led2_off
	reti


rx2m1:	lds RxChannel2L, tcnt1l			;falling, calculate the pulse length
	lds RxChannel2H, tcnt1h

	sub RxChannel2L, RxChannel2StartL
	sbc RxChannel2H, RxChannel2StartH

	clr RxChannelsUpdatingFlag

	out sreg,tisp				;exit	
;led2_off
	reti



RxChannel3:
;led2_on
	ser RxChannelsUpdatingFlag

	in tisp, sreg

	sbis pind,3				;rising or falling?
	rjmp rx3m1


	lds RxChannel3StartL, tcnt1l		;rising, store the start value
	lds RxChannel3StartH, tcnt1h

	clr RxChannelsUpdatingFlag

	out sreg,tisp				;exit	
;led2_off
	reti


rx3m1:	lds RxChannel3L, tcnt1l			;falling, calculate the pulse length
	lds RxChannel3H, tcnt1h

	sub RxChannel3L, RxChannel3StartL
	sbc RxChannel3H, RxChannel3StartH

	clr RxChannelsUpdatingFlag

	out sreg,tisp				;exit	
;led2_off
	reti



RxChannel4:
;led2_on
	ser RxChannelsUpdatingFlag

	in tisp, sreg

	sbis pinb,7				;rising or falling?
	rjmp rx4m1


	lds RxChannel4StartL, tcnt1l		;rising, store the start value
	lds RxChannel4StartH, tcnt1h

	clr RxChannelsUpdatingFlag

	out sreg,tisp				;exit	
;led2_off
	reti


rx4m1:	lds RxChannel4L, tcnt1l			;falling, calculate the pulse length
	lds RxChannel4H, tcnt1h

	sub RxChannel4L, RxChannel4StartL
	sbc RxChannel4H, RxChannel4StartH

	clr RxChannelsUpdatingFlag

	out sreg,tisp				;exit	
;led2_off
	reti




	
	;--- Get and scale RX channel inputs ---


RxGetChannels:
	tst RxChannelsUpdatingFlag	;channel 1 (Roll)	
	brne RxGetChannels

	mov xl,RxChannel1L
	mov xh,RxChannel1H

	rcall XAbs

	clr yl
	clr yh
	b16store RxChannel

	rcall ScaleMinus100To100

	b16mov RxInRoll,RxChannel



c2:	tst RxChannelsUpdatingFlag	;channel 2 (Pitch)	
	brne c2

	mov xl,RxChannel2L
	mov xh,RxChannel2H

	rcall XAbs

	clr yl
	clr yh
	b16store RxChannel

	rcall ScaleMinus100To100

	b16mov RxInPitch,RxChannel



c3:	tst RxChannelsUpdatingFlag	;channel 3 (Collective)	
	brne c3

	mov xl,RxChannel3L
	mov xh,RxChannel3H

	rcall XAbs

	clr yl
	clr yh
	b16store RxChannel

	rcall Scale0To100

	b16mov RxInCollective,RxChannel



c4:	tst RxChannelsUpdatingFlag	;channel 4 (Yaw)	
	brne c4

	mov xl,RxChannel4L
	mov xh,RxChannel4H

	rcall XAbs

	clr yl
	clr yh
	b16store RxChannel

	rcall ScaleMinus100To100

	b16mov RxInYaw,RxChannel

	ret



XAbs:	tst xh		;X = ABS(X)
	brpl xa1

	ldi t,0xff
	eor xl,t
	eor xh,t
	
	ldi t,1
	add xl,t
	clr t
	adc xh,t

xa1:	ret


ScaleMinus100To100:
	b16ldi Temp, 1520
	b16sub RxChannel, Temp
	b16load RxChannel	;divide RxChannel by 4
	ldi t,2
	rcall FastDivide
	b16store RxChannel
	ret


Scale0To100:
	b16ldi Temp, 1120
	b16sub RxChannel, Temp
	brcc sc1
	b16ldi RxChannel, 0
sc1:	b16load RxChannel	;divide RxChannel by 8
	ldi t,3
	rcall FastDivide
	b16store RxChannel
	
	ret



FastDivide:
	asr xh		;X.Y Fast divide by 2n
	ror xl
	ror yh
	ror yl
	dec t
	brne Fastdivide
	ret


FastMultiply:
	lsl yl
	rol yh
	rol xl
	rol xh
	dec t
	brne FastMultiply
	ret





	;--- Debug: ----
/*
ShowGyros:
	ldi xl,0x0d
	rcall SerbyteOut

	ldi xl,0x0a
	rcall SerbyteOut


	b16load GyroRoll
	rcall B1616Out
	ldi xl,' '
	rcall SerByteOut

	b16load GyroPitch
	rcall B1616Out
	ldi xl,' '
	rcall SerByteOut

	b16load GyroYaw
	rcall B1616Out
	ldi xl,' '
	rcall SerByteOut

	ret



ShowChannels:
	
	ldi xl,0x0d
	rcall SerbyteOut

	ldi xl,0x0a
	rcall SerbyteOut


	b16load RxInRoll
	rcall B1616Out
	ldi xl,' '
	rcall SerByteOut

	b16load RxInPitch
	rcall B1616Out
	ldi xl,' '
	rcall SerByteOut

	b16load RxInCollective
	rcall B1616Out
	ldi xl,' '
	rcall SerByteOut

	b16load RxInYaw
	rcall B1616Out
	ldi xl,' '
	rcall SerByteOut

	ret




B1616Out:
	push yl
	push yh
	push xl

	mov xl,xh
	rcall SerByteAsciiOut
	pop xl
	rcall SerByteAsciiOut
	ldi xl,'.'
	rcall SerByteOut
	pop xl
	rcall SerByteAsciiOut
	pop xl
	rcall SerByteAsciiOut
	ret


B16Out:
	push xl

	mov xl,xh
	rcall SerByteAsciiOut
	pop xl
	rcall SerByteAsciiOut
	ret



	;--- Debug: Output byte xl (ASCII) to serial port pin at 115200 8N1 ----

SerByteAsciiOut:


	push xl
	swap xl
	rcall su1		;high nibble
	pop xl
	rjmp su1		;low nibble

su1:	andi xl,0x0f
	ldi zl,low(su2*2)	;output one nibble in ASCII
	add zl,xl
	ldi zh,high(su2*2)
	clr xl
	adc zh,xl
	lpm xl,z
	rjmp SerByteOut

su2:	.db "0123456789ABCDEF"


		



	;--- Debug: Output byte xl (binary) to serial port pin at 115200 8N1 ----

SerByteOut:
	led3_off		;startbit
	nop
	nop
	nop

	rcall BaudRateDelay	

	ldi xh,8		;databits

se3:	ror xl

	brcc se1
	nop
	led3_on
	rjmp se2
se1:	led3_off
	nop
	nop

se2:	rcall BaudRateDelay

	dec xh
	brne se3

	nop
	nop
	nop
	nop

	led3_on			;stopbit
	nop 
	nop
	nop
	rcall BaudRateDelay

	ret

BaudRatedelay:

	ldi t,17
ba1:	dec t
	brne ba1
	ret
	

*/



.include "1616mathlib_ram_v1.asm"
- (in startup jump to main loop)
- calibration measurement
- main loop (gyro gain 0 if not calibrated)
- if calibrated -> back to main loop
- calibration check measurement
- if not ok -> back to calibration measurement
- if ok -> flag ok and jump to main loop

I was wondering if that main loop could be run as a loop.. So it would work as a delay for first startup and in between of calibration measurement and check measurement. The idea of the calibration check is that calibration is done only in no motion but the control works without gyros if not calibrated.
ChiKung is offline Find More Posts by ChiKung
Reply With Quote
Old Nov 17, 2011, 11:57 AM
Registered User
Украина, Запорожская область, Запорожье
Joined Jun 2011
18 Posts
Quote:
Originally Posted by e_lm_70 View Post
Guys ...

Finally I got my programming USB cable for the KK board.

No instruction included ...

Can anybody tell me what is for the jumper ?

This is J2 on the USB-board.

Thanks

e_lm_70


...this jumper is not used usually
sovit is offline Find More Posts by sovit
Reply With Quote
Old Nov 17, 2011, 12:28 PM
Registered User
Austria
Joined Jan 2004
7,234 Posts
Quote:
Originally Posted by sovit View Post
...this jumper is not used usually
I think I found what it is ...

It is sending out or not the 5v from USB module to the KK board.

BTW

Is the aeroplane code for KK open source ?
e_lm_70 is offline Find More Posts by e_lm_70
Reply With Quote
Old Nov 17, 2011, 03:41 PM
Registered User
HELModels's Avatar
Joined Aug 2003
2,616 Posts
I just loaded aeroplane 1.7 onto my HK KK and it doesnt do anything. I've got the motor ESC plugged into the Rx. The board flashes once when I plug the battery into the ESC. I've got a servo on M1 M3 M5. I've got ail, rud, ele connected from the board to the Rx. The servos move and then stop and nothing happens when I move the board. How do I arm the board?

EDIT: I got it! I powered the HK KK from the Rx by plugging the ESC(just for the BEC)into Aux and then to arm I moved the elevator stick down and the servos came to life. As I rotate the HK KK, the servos respond just like I wanted.
HELModels is offline Find More Posts by HELModels
Last edited by HELModels; Nov 17, 2011 at 04:14 PM.
Reply With Quote
Old Nov 18, 2011, 03:33 AM
Registered User
Austria
Joined Jan 2004
7,234 Posts
Quote:
Originally Posted by HELModels View Post
I just loaded aeroplane 1.7 onto my HK KK and it doesnt do anything. I've got the motor ESC plugged into the Rx. The board flashes once when I plug the battery into the ESC. I've got a servo on M1 M3 M5. I've got ail, rud, ele connected from the board to the Rx. The servos move and then stop and nothing happens when I move the board. How do I arm the board?

EDIT: I got it! I powered the HK KK from the Rx by plugging the ESC(just for the BEC)into Aux and then to arm I moved the elevator stick down and the servos came to life. As I rotate the HK KK, the servos respond just like I wanted.
Where you got this Firmware ?

I just know this one for aeroplane : XXcontrol_KR_AeroPlane v2.4 (http://www.kkmulticopter.kr/index.ht...a=xxcontroller)

Is the source available for this 1.7 ?

Thanks

e_lm_70
e_lm_70 is offline Find More Posts by e_lm_70
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Quadrotor brushless controller airbotix Multirotor Talk 63 Aug 06, 2010 11:15 AM
Discussion ALPO -Aerobatic Low Parts count Original design. Brian Courtice Foamies (Scratchbuilt) 8 Sep 21, 2009 03:57 AM
Discussion Any tips for my first flight with a low wing plane? Warthog_Fan Fuel Plane Talk 4 Sep 06, 2009 07:53 AM
Help! Need help with Low-cost QuadRotor Hero.sl Coaxial Helicopters 5 Jun 28, 2009 02:26 AM
Question Searching Simple Controller for Free Flight flymax Power Systems 8 Jan 07, 2006 10:07 AM