Re: Really Unexpected Task Behavior
Posted: 20 Feb 2012, 18:45
Everything I write in Delphi I try to write so that it can be compiled with Free Pascal and Lazarus. It is not 100% compatible with Lazarus at this point but my NeXTTools/NXTCC utility for Mac OS X and Linux are both built using Lazarus and Free Pascal on Mac and Linux platforms using exactly the same sourceforge code that I compile using Delphi. I would love to have some help from people like yourself and others here who might be interested in working with me to enhance the BricxCC IDE to support code folding, terminal window output, breakpoints, better variable watching, etc...
You can buy the Delphi XE2 Starter edition online from Embarcadero.com for $149, btw. The current codebase works with Delphi 7 but with a little work I think I can get it to compile with XE2.
So, you are saying that if you use SendRemoteString that you get data on the PC but not if you use BluetoothWrite?
Here's the code for SendRemoteString and BluetoothWrite:
As you can see from the above code, SendRemoteString calls __bluetoothWrite with a buffer that contains a valid MessageWrite direct command. So it is really not possible for the problem to be on the NXT side - at least not at the API level. Perhaps in your code, which I have not yet seen.
John Hansen
You can buy the Delphi XE2 Starter edition online from Embarcadero.com for $149, btw. The current codebase works with Delphi 7 but with a little work I think I can get it to compile with XE2.
So, you are saying that if you use SendRemoteString that you get data on the PC but not if you use BluetoothWrite?
Here's the code for SendRemoteString and BluetoothWrite:
Code: Select all
#define __sendRemoteString(_conn, _queue, _str, _result) \
acquire __RemoteMutex \
mov __SRSTmpBuf, __DCMessageWritePacket \
replace __SRSTmpBuf, __SRSTmpBuf, 2, _queue \
arrsize __SRSTmpLongVal, _str \
replace __SRSTmpBuf, __SRSTmpBuf, 3, __SRSTmpLongVal \
arrbuild __SRSSendBuf, __SRSTmpBuf, _str \
__connectionSCDCWrite(_conn, __SRSSendBuf, _result) \
release __RemoteMutex
#define __connectionSCDCWrite(_conn, _buffer, _result) \
brcmp LT, __ConnWrite_Else##__I__, _conn, 4 \
__RS485WriteSCDC(_conn, _buffer, _result) \
jmp __ConnWrite_EndIf##__I__ \
__ConnWrite_Else##__I__: \
__bluetoothWrite(_conn, _buffer, _result) \
__ConnWrite_EndIf##__I__: \
__IncI__
#define __bluetoothWrite(_conn, _buffer, _result) \
acquire __CBTWMutex \
mov __CBTWArgs.Connection, _conn \
mov __CBTWArgs.Buffer, _buffer \
syscall CommBTWrite, __CBTWArgs \
mov _result, __CBTWArgs.Result \
release __CBTWMutex
John Hansen