First the quick answer: The XBee in/out pin constants are not needed as we are now using HSERIAL (in the Arc32 version HSERIAL2). So the actual pins are taken care of by the hardware. Should remove comments about those constants…
As for IO pins and mapping to underlying hardware, as I mentioned before I figured out, while I was working on C library. Nathan helped correct it in a few places.
Here is one of my tables for the Arc32:
[code]const PORTITEM g_PortTableArc32] =
{
{&IO.PDR5.BYTE, 0x10, {PUR_5, PMR_5, 0xf}}, // P0 servo0 (P54/WKP4)
{&IO.PDR5.BYTE, 0x20, {PUR_5, PMR_5, 0xf}}, // P1 servo1 (P55/WKP5/ADTRG)
{&IO.PDR1.BYTE, 0x1, {PUR_1, PMR_1, 0xf}}, // P2 servo2 (P10/TMOW)
{&IO.PDR1.BYTE, 0x2, {PUR_1,0, 0xf}}, // P3 servo3 (P11/PWM)
{&IO.PDR1.BYTE, 0x4, {PUR_1, PMR_1, 0xf}}, // P4 servo4 (P12)
{&IO.PDR7.BYTE, 0x20, {0,0, 0xf}}, // P5 servo5 (P75/TMCIV)
{&IO.PDR7.BYTE, 0x40, {0,0, 0xf}}, // P6 servo6 (P76/TMOV)
{&IO.PDR2.BYTE, 0x8, {0,0, 0xf}}, // P7 servo7 (P23)
{0,0,{0,0, 0xf}}, // P8
{0,0,{0,0, 0xf}}, // P9
{0,0,{0,0, 0xf}}, // P10
{0,0,{0,0, 0xf}}, // P11
{0,0,{0,0, 0xf}}, // P12
{0,0,{0,0, 0xf}}, // P13
{0,0,{0,0, 0xf}}, // P14
{0,0,{0,0, 0xf}}, // P15
{&IO.PDR5.BYTE, 0x8, {PUR_5, PMR_5, 0xf}}, // P16 servo16 (P53/WKP3)
{&IO.PDR5.BYTE, 0x4, {PUR_5, PMR_5, 0xf}}, // P17 servo17 (P52/WKP2)
{&IO.PDR5.BYTE, 0x2, {PUR_5, PMR_5, 0xf}}, // P18 servo18 (P51/WKP1)
{&IO.PDR5.BYTE, 0x1, {PUR_5, PMR_5, 0xf}}, // P19 servo19 (P50/WKP0)
{&IO.PDR3.BYTE, 0x1, {0,0, 0xf}}, // P20 servo20 (P30)
{&IO.PDR3.BYTE, 0x2, {0,0, 0xf}}, // P21 servo21 (P31)
{&IO.PDR3.BYTE, 0x4, {0,0, 0xf}}, // P22 servo22 (P32)
{&IO.PDR3.BYTE, 0x8, {0,0, 0xf}}, // P23 servo23 (P33)
{0,0,{0,0, 0xf}}, // P24
{0,0,{0,0, 0xf}}, // P25
{0,0,{0,0, 0xf}}, // P26
{0,0,{0,0, 0xf}}, // P27
{&IO.PDR1.BYTE, 0x80, {PUR_1, PMR_1, 0xf}}, // P28 servo28 (P17/IRQ3/TRGV)
{&IO.PDR1.BYTE, 0x40, {PUR_1, PMR_1, 0xf}}, // P29 servo29 (P16/IRQ2)
{&IO.PDR1.BYTE, 0x20, {PUR_1, PMR_1, 0xf}}, // P30 servo30 (P15/IRQ1/TMIB1)
{&IO.PDR1.BYTE, 0x10, {PUR_1, PMR_1, 0xf}}, // P31 servo41 (P14/IRQ0)
{&IO.PDR2.BYTE, 0x2, {0,0, 0xf}}, // S_IN (P32) (P22/RXD
{&IO.PDR2.BYTE, 0x4, {0,0, 0xf}}, // S_OUT TXD(P33) (P24/TXD)
{&IO.PDR5.BYTE, 0x80, {PUR_5, PMR_5, 0xf}}, // P34 AUX1 pin1 (P57/SCL)
{&IO.PDR5.BYTE, 0x40, {PUR_5, PMR_5, 0xf}}, // P35 AUX1 pin2 (P56/SDA)
{&IO.PDR7.BYTE, 0x4, {0,0, 0xf}}, // P36 AUX1 pin3 (P72/TXD_2)
{&IO.PDR7.BYTE, 0x1, {0,0, 0xf}}, // P37 AUX1 pin4 (P70/SCK3_2)
{&IO.PDR7.BYTE, 0x2, {0,0, 0xf}}, // P38 AUX1 pin5 (P71/RXD_2)
{&IO.PDR3.BYTE, 0x80, {0,0, 3}}, // P39 AUX1 pin6 (P37) and (PB3/AN3)
{&IO.PDR2.BYTE, 0x10, {0,0, 0xf}}, // P40 AUX2 pin2 (P24) with pullup
{&IO.PDR8.BYTE, 0x20, {0,0, 0xf}}, // P41 AUX2 pin4 (P85) with pullup
{&IO.PDR8.BYTE, 0x40, {0,0, 0xf}}, // P42 AUX2 pin6 (P86) with pullup
{&IO.PDR8.BYTE, 0x80, {0,0, 0xf}}, // P43 AUX2 pin8 (P87) with pullup
{&IO.PDR3.BYTE, 0x40, {0,0, 0xf}}, // P44 Status LED (P36)
{&IO.PDR7.BYTE, 0x10, {0,0, 0xf}}, // P45 Batt LED (P74/TMRIV)
{&IO.PDR3.BYTE, 0x10, {0,0, 0xf}}, // P46 MUX A (P34)
{&IO.PDR3.BYTE, 0x20, {0,0, 0xf}}, // P47 MUX B (P35)
{&IO.PDR6.BYTE, 0x1, {0,0, 0xf}}, // P48 U24 X (P60/FTIOA0)
{&IO.PDR6.BYTE, 0x2, {0,0, 0xf}}, // P49 U24 Y (P61/FTIOB0)
{&IO.PDR6.BYTE, 0x4, {0,0, 7}}, // P50 U21 X (P62/FTIOC0) (PB7/AN7)
{&IO.PDR6.BYTE, 0x8, {0,0, 6}}, // P51 U21 Y (P63/FTIOD0) (PB6/AN6)
{&IO.PDR6.BYTE, 0x10, {0,0, 0xf}}, // P52 U22 X (P64/FTIOA1)
{&IO.PDR6.BYTE, 0x20, {0,0, 0xf}}, // P53 U22 Y (P65/FTIOB1)
{&IO.PDR6.BYTE, 0x40, {0,0, 4}}, // P54 U23 Y (P66/FTIOC1) (PB4/AN4)
{&IO.PDR6.BYTE, 0x80, {0,0, 5}}, // P55 U23 X (P67/FTIOD1) (PB5/AN5)
{&IO.PDRB.BYTE, 0x1, {0,0, 0}}, // P56 VS1 (PB0/AN0)
{&IO.PDRB.BYTE, 0x2, {0,0, 1}}, // P57 VL (PB1/AN1)
{&IO.PDRB.BYTE, 0x4, {0,0, 2}}, // P58 VS2 (PB2/AN2)
{&IO.PDR7.BYTE, 0x20, {0,0, 0xf}}, // SCL
{&IO.PDR7.BYTE, 0x40, {0,0, 0xf}} // SDA
};
// How the MUXS are connected to the servos…
//Channel FTIOA0 FTIOB0 FTIOC0 FTIOD0 FTIOA1 FTIOB1 FTIOC1 FTIOD1
//0 2 7 10 15 18 20 28 25
//1 1 4 9 12 17 23 31 26
//2 0 6 8 14 16 21 29 27
//3 3 5 11 13 19 22 30 24
[/code]
As the table implies, not all Arc32 IO pins have an underlying H8 IO pin. Also note: there is some confusion issues with the actual IO pin numbers. If you look at the Arc32 manual, for example you will see P34 defined twice. Once it is defined as to get the voltage for S2, the other time it is defined as the SCL pin. Why? Because some of their commands map them differently… Personally I think that is bad, but…
Many of them are only connected through the MUXs. Also I have not double checked the code to check for Voltages. There is an interesting issue, that I have not done anything about yet. That is the command:
adin cVoltagePin, Voltage ; Battery voltage
Does not work on Arc32 you need to use the HSERVOSTATE command, that implies that HSERVO would have to be running… Unless maybe without HSERVO the adin command on one of the underlying voltage pins (P56-P58), which are actually hooked up to ADIN pins (not through MUX), may work…
Kurt