LabVIEW LEGO MINDSTORMS NXT Module Programming Guide Manual

LabVIEW LEGO MINDSTORMS NXT Module Programming Guide Manual
Pages 97
Views 773
Downloads : 2 times
PDF Size : 572.7 KiB

Summary of Contents

LabVIEW LEGO MINDSTORMS NXT Module Programming Guide Manual

  • Chapter 2Extensions to LabVIEW© National Instruments Corporation2-13LabVIEW LEGO MINDSTORMS NXT ModuleA call to NXTCommLSWrite constitutes the start of an asynchronous transaction between the NXT brick and a digital device, such that the program continues to run while the firmware manages sending bytes from the write buffer and reading the response bytes from the device. Because the NXT brick is the master device, you must also specify the number of bytes to expect from the device in response to each write operation. You can exchange up to 16 bytes in each direction per transaction.After you start a write transaction with NXTCommLSWrite, use NXTCommLSCheckStatus in a While Loop to check the status of the port. If NXTCommLSCheckStatus returns a status code of zero and a count of bytes available in the read buffer, the system is ready for you to use NXTCommLSRead to copy the data from the read buffer into your own buffer.Note that any of these calls might return various status codes at any time. A status code of zero means the port is idle and the last transaction, (if any), did not result in any errors. Negative status codes indicate errors, while the positive status code STAT_COMM_PENDING indicates that a transaction is in progress on the specified port.The following sections provide more information about each low-speed communication method.