.........Mit dem Source-Code weiß ich auch nicht, was er gemeint hat, würd mich aber auch interessieren (weniger der source-code, eher die Kommandocodes Very Happy)...........
commando-code, ganz leicht zu erzeugen mit einer ir-diode :
Code:
The IR Carrier is 39.2kHz. Data is modulated using a space coded signal with 8 data bits (data clock is 1200Hz,
but actual data rate varies depending on the data).
You can skip the IR and IR modulation by wiring directly into the main PCBoard.
This can be encoded easily by almost any small microprocessor.
For modulating the signals yourself, the signal looks something like this:
Timing based on 1/1200 second clock (~.833ms)
Signal is normally high (idle, no IR).
Start: signal goes low for 8/1200 sec.
Data bits: for each of 8 data bits, space encoded signal depending on bit value
Sends the most significant data bit first
If the data bit is 0: signal goes high for 1/1200 sec, and low for 1/1200 sec.
If the data bit is 1: signal goes high for 4/1200 sec, and low for 1/1200 sec.
BTW: The first bit (msb) is always 1 (valid codes are from $80 to $FF)
When completed, signal goes high again.
No explicit stop bit. Minimal between signals is not known.
Movement Commands (no shift)
* $80 - turn right (on left side of remote)
* $81 - right arm up (upper left button on remote)
* $82 - right arm out
* $83 - tilt body right
* $84 - right arm down
* $85 - right arm in
* $86 - walk forward
* $87 - walk backward
* $88 - turn left (on right side of remote)
* $89 - left arm up (upper right button on remote)
* $8A - left arm out
* $8B - tilt body left
* $8C - left arm down
* $8D - left arm in
* $8E - stop
Programming Commands (no shift)
* $90 - P (Master Command Program)
* $91 - P>> (Program Play, the one on the bottom)
* $92 - R>> (Right sensor program)
* $93 - L>> (Left sensor program)
* $94 - S>> (Sonic sensor program)
GREEN shift commands
* $A0 - right turn step
* $A1 - right hand thump
* $A2 - right hand throw
* $A3 - sleep
* $A4 - right hand pickup
* $A5 - lean backward
* $A6 - forward step
* $A7 - backward step
* $A8 - left turn step
* $A9 - left hand thump
* $AA - left hand throw
* $AB - listen
* $AC - left hand pickup
* $AD - lean forward
* $AE - reset
* $B0 - Execute (master command program execute)
* $B1 - Wakeup
* $B2 - Right (right sensor program execute)
* $B3 - Left (left sensor program execute)
* $B4 - Sonic (sonic sensor program execute)
ORANGE shift commands
* $C0 - right hand strike 3
* $C1 - right hand sweep
* $C2 - burp
* $C3 - right hand strike 2
* $C4 - high 5
* $C5 - right hand strike 1
* $C6 - bulldozer
* $C7 - oops (fart)
* $C8 - left hand strike 3
* $C9 - left hand sweep
* $CA - whistle
* $CB - left hand strike 2
* $CC - talkback
* $CD - left hand strike 1
* $CE - roar
* $D0 - All Demo
* $D1 - Power Off (drop snow-globe and say "Rosebud")
* $D2 - Demo 1 (Karate skits)
* $D3 - Demo 2 (Rude skits)
* $D4 - Dance
NOTES:
* add $08 to go from right-side commands to left-side commands.
* add $20 to command bytes for the GREEN shift (ie. $Ax and $Bx range)
das ist der code in fastavr-basic , es wird ein wert vom pc empfangen und mit dem programm auf dem AVR in den ir-code umgesetzt, und der robosapien bewegt sich :
Code:
$Device= m16
$Stack = 32
$Clock = 8
$Timer1=Timer, Prescale=1, CompareA=Toggle, Clear
$Baud = 19200
Dim command As Byte, ii As Byte
Dim eingabe As String* 5
Declare Sub irout()
Compare1A=101
Start Timer1
$Timer1=Timer, CompareA=Reset
DDRD.5=1
Do
Input eingabe
command=Val(eingabe)
irout()
Loop
Sub irout()
$Timer1=Timer, CompareA=Toggle
wait_us 6666
$Timer1=Timer, CompareA=Reset
For ii=0 To 7
If command.7 =0 Then
wait_us 833
$Timer1=Timer, CompareA=Toggle
wait_us 833
$Timer1=Timer, CompareA=Reset
Else
wait_us 3333
$Timer1=Timer, CompareA=Toggle
wait_us 833
$Timer1=Timer, CompareA=Reset
End If
Shift(Left,1,command)
Next
End Sub
ps: die wait_us müssen sehr präzise sein, evtl eine asm-routine einbinden.
Lesezeichen