I built my Transponder with Open Cockpits Displays and 2 rotary encoders. The high digits are working fine but the low digits stay at 00. The encoder works fine in the SIOC Monitor. Display digit numbers are correct. It must be something in my code:
Var 0251, Value 12 // High digits
{
CALL &XPNDRCALC
}
Var 0252, Value 0 // Low digits
{
CALL &XPNDRCALC
}
Var 0253, name INPXPNDRHigh, Link IOCARD_ENCODER, Input 124, Aceleration 1, Type 2 // Input High
{
L0 = &INPXPNDRHigh * 1 // -1 will change direction of rotation
V0251 = V0251 + L0
V0251 = ROTATE 0 ,77 ,L0
}
Var 0254, name INPXPNDRLow, Link IOCARD_ENCODER, Input 118, Aceleration 1, Type 2 // Input Low
{
L0 = &INPXPNDRLow * 1 // -1 will change direction of rotation
V0252 = V0252 + L0
V0252 = ROTATE 0 ,77 ,L0 // numbers will range from 0 to 77 then bac
}
Var 0255, Link IOCARD_SW, Input 63 // VFR button
{
&XPNDRDISP = 1200 // VFR Code CH 7000 USA 1200 Germany 0021
&XPNDRTOFS = TOBCD &XPNDRDISP
}
Var 0256, name XPNDRDISP, Link IOCARD_DISPLAY, Digit 123, Numbers 4 // Display
{
L0 = &XPNDRDISP
}
Var 0257, name XPNDRTOFS, Link FSUIPC_INOUT, Offset $0354, Length 2 // XPNDR
{
L0 = &XPNDRDISP
}
Var 0258, name XPNDRIN, Value 7000 // XPNDR Input from FS
Var 0259, Link FSUIPC_OUT, Offset $7B93, Length 4 // IDT button for Squawkbox
Var 0260, Link IOCARD_SW, Input 113 // IDT button
{
V0259 = V0260
}
Var 0261, name XPNDRCALC, Link SUBRUTINE // Code calculation
{
L0 = V0251 * 100
L1 = V0252 + L0
&XPNDRTOFS = TOBCD L0
&XPNDRDISP = L0
}
This is what happens in the IOCPConsole when I rotate the High Digits, then the Low Digits:
HIGH DIGITS
253=1 - INPXPNDRHigh
251=11 - High digits
257=4352 - XPNDRTOFS
256=1100 - XPNDRDISP
251=12 - High digits
257=4608 - XPNDRTOFS
256=1200 - XPNDRDISP
253=0 - INPXPNDRHigh
251=13 - High digits
257=4864 - XPNDRTOFS
256=1300 - XPNDRDISP
251=14 - High digits
257=5120 - XPNDRTOFS
256=1400 - XPNDRDISP
253=0 - INPXPNDRHigh
253=1 - INPXPNDRHigh
251=15 - High digits
257=5376 - XPNDRTOFS
256=1500 - XPNDRDISP
251=16 - High digits
257=5632 - XPNDRTOFS
256=1600 - XPNDRDISP
253=0 - INPXPNDRHigh
253=1 - INPXPNDRHigh
251=17 - High digits
257=5888 - XPNDRTOFS
256=1700 - XPNDRDISP
251=18 - High digits
257=6144 - XPNDRTOFS
256=1800 - XPNDRDISP
253=0 - INPXPNDRHigh
257=4096 - XPNDRTOFS
LOW DIGITS
254=1 - INPXPNDRLow
252=75 - Low digits
252=76 - Low digits
254=0 - INPXPNDRLow
254=1 - INPXPNDRLow
252=77 - Low digits
252=0 - Low digits
254=0 - INPXPNDRLow
254=1 - INPXPNDRLow
252=1 - Low digits
252=2 - Low digits
254=0 - INPXPNDRLow
254=1 - INPXPNDRLow
252=3 - Low digits
252=4 - Low digits
254=0 - INPXPNDRLow
It doesn't seem to be sending the Low Digits to FS. Am I using the wrong code for a two encoder XPNDR?
Jerry