Here’s a little program update. When I asked for a formula for converting the joystick values to the servo output values I mistakenly used 900us to 2100uS. This caused a problem in the receiver resulting on a non-symmetrical response. I needed to change it to 1000uS to 2000uS. To avoid floating math I multiplied by 42, subtracted 6500 then divided the result by 10. Beth created a spreadsheet formula so we could alter the two values to get the best result. So now the LCD displays the correct values and the joysticks now center at 1500 and have a symmetrical throw. Next I will throw a Bot Board II and Atom Pro on the receiver side and start writing a simple routine to measure the keypad channels to turn some LED’s on and off.
[code]cha1 var word
cha2 var word
cha3 var word
cha4 var word
cha5 var word
cha6 var word
cha7 var word
a_key var bit
b_key var bit
c_key var bit
sound 9, [100\880, 100\988, 100\1046, 100\1175]
serout 8,N9600,[12, 14]
low 15
start:
adin 16, cha1 ;right vertical
adin 17, cha2 ;right horizontal
adin 18, cha3 ;left vertical
adin 19, cha4 ;left horizontal
;convert joystick values 392 - 692 to servo values 1000uS - 2000uS
cha1=(((cha142)-6500)/10)
cha2=(((cha242)-6500)/10)
cha3=(((cha342)-6500)/10)
cha4=(((cha442)-6500)/10)
cha5=1500
cha6=1500
cha7=1500
serout 8,N9600,[16, 64, dec cha3, 16, 76, dec cha1, 16, 80, dec cha4, 16, 92, dec cha2]
;serout 8,N2400,"hello world “]
;serout S_OUT,i57600,[dec5 cha1\5,” “,dec5 cha2\5,” “,dec5 cha3\5,” “,dec5 cha4\5,” ",13]
makepulses:
pulsout 15,800
pauseus ((cha12)-800)
pulsout 15,800
pauseus ((cha22)-800)
pulsout 15,800
pauseus ((cha32)-800)
pulsout 15,800
pauseus ((cha42)-800)
pulsout 15,800
pauseus ((cha52)-800)
pulsout 15,800
pauseus ((cha62)-800)
pulsout 15,800
pauseus ((cha7*2)-800)
pulsout 15,800
goto start[/code]