Hi Alan,
Nice car!
Yep, it has a lot to do with the processor only has 1 UART and the BB2 PS2 connection is on the same pins. That is where it is nice to use the Atmega 1280 processors like what is on the Axon2 board and I believe the Arduino Mega boards as they have 4 UARTS.
I do have these ASM functions in files that are included with all of my XBee programs and the like.
I have moved the pins. Having a little issue with the PS2. On a few other robots, I was successful in using the processors pull-up resistor on the data line to make the PS2 work, but on this processor/PS2 controller I think it is a bit flaky. Will experiment some more.
At one time I was going to try the Lantronix, bought one, soldered up a connection board to handle it and I think I screwed up the voltages or the like and probably fried it… I may try the Trendnet camera on my tri-track.
Yep - I was just sort-of whining. That is for example with my XBee stuff, on some robots I want to not use HSERIAL with them as that can screw up the serial for other things, but some I do and on those some are Bap28’s which I use HSERIAL and others will be Arc32’s which I will use HSERIAL2. Nathan(AcidTech) was working on a partial fix that if you may be able to say usehserial2 on the Bap28 and it will actually use the first serial port, which would help. On the Arc32 I like to use both as it is nice to get reliable debug serial stuff at higher baud rates. Without any help, the Xbee code will end up looking something like:
[code];==============================================================================
; [SetXbeeDL] - Set the XBee DL to the specified word that is passed
; BUGBUG: sample function, need to clean up.
;==============================================================================
wNewDL var word
SetXBeeDL[wNewDL]:
#ifdef DEBUG_VERBOSE
;bugbug;;; debug
serout s_out, i9600, "Set XBEE DL: ", hex wNewDL, 13]
#endif
#ifdef XBEEONHSERIAL
pause 20 ; have to have a guard time to get into Command sequence
hserout [str _XBEE_PPP_STR\3]
gosub WaitHSeroutComplete
pause 20 ; have to wait a bit again
hserout "ATDL ",hex wNewDL, 13, | ; Set the New DL
str _XBEE_ATCN_STR\5] ; Exit command mode
pause 10
#else if XBEEONHSERIAL2
pause 20 ; have to have a guard time to get into Command sequence
hserout2 [str _XBEE_PPP_STR\3]
gosub WaitHSeroutComplete2
pause 20 ; have to wait a bit again
hserout2 "ATDL ",hex wNewDL, 13, | ; Set the New DL
str _XBEE_ATCN_STR\5] ; Exit command mode
pause 10
#else
pause 20 ; have to have a guard time to get into Command sequence
serout cXBEE_OUT, cXBEE_BAUD, [str _XBEE_PPP_STR\3]
pause 20 ; have to wait a bit again
serout cXBEE_OUT, cXBEE_BAUD,"ATDL ",hex wNewDL, 13, | ; Set the New DL
str _XBEE_ATCN_STR\5] ; Exit command mode
pause 10
#endif
return
[/code]
Note: the could be changed such not as much under #ifdef, but you would then have to repeat it for each serout/hserout/hserout2… In my C libraries I handled something like this by having my functions IOPrintf, check for -1 and -2 as the IOpin and converting them to the appropriate hardware calls. I probably still have a little work in there to also abstract out some of the other calls, like: hserstat, such that I could ask is the output complete and on non hardware serial ports it would always return true… Also again this would be easier in C. You can simply define a couple of macros or inline functions, like: XBeeOut and DBGOut which default to the right calls and pass along the parameters. But…
But you use what you got…
Kurt