The NBC compiler on my machine has a defect with the GetBrickDataAddress function which causes a compiler error due to it generating nested asm blocks which are not valid syntax. A while back I added some low level IOMap routines to NXCDefs.h which broke that function along with a few others. What version of the compiler are you running?
In any case, I figured out what was going wrong and fixed the header file. I thought for a while it was a parsing bug caused by recent changes I made in the compiler itself but as far as I can tell it was just a problem in the NXCDefs.h header.
Here's a sample program (which I have checked in as a replacement for the ex_GetBrickDataAddress.nxc stub that is in the currently released help file):
- Code: Select all
// 6 bytes plus null
TextOut(0, LCD_LINE1, StrCat(
The 7 bytes written to the array passed into GetBrickDataAddress include 6 bytes of Bluetooth ID and a null. The 12 digits are those 6 byte values (2 hex digits == 1 byte). The above code writes out a 12 hex digit string which is the NXT's ID. You could, of course, store that ID in a string rather than writing it to the LCD. The FormatNum function requires the enhanced NBC/NXC firmware. You could write a hex formatting function of your own that would work with the standard firmware if you need to support it.