To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 26804
26803  |  26805
Subject: 
NXC/NBC release news
Newsgroups: 
lugnet.robotics, lugnet.robotics.nxt
Date: 
Mon, 29 Jan 2007 16:44:50 GMT
Viewed: 
8770 times
  
I have posted beta 24 of NBC/NXC.  Here's the list of fixes and new features:

Version 1.0.1.b24
-----------------
- Fixes a preprocessor bug in NBC and NXC that is triggered by not having a ')'
at the end of a macro invocation (or anywhere following in the entire program).
- Replaced the ResetMotor macros in NBC and NXC with the following macros:
    ResetTachoCount(p)
    ResetBlockTachoCount(p)
    ResetRotationCount(p)
    ResetAllTachoCounts(p)
- Added NBC API file i/o macros
    Read(handle, n, result)
    ReadLn(handle, n, result)
    ReadBytes(handle, len, buf, result)
    Write(handle, n, result)
    WriteLn(handle, n, result)
    WriteString(handle, str, cnt, result)
    WriteLnString(handle, str, cnt, result)
    WriteBytes(handle, buf, cnt, result)
    WriteBytesEx(handle, len, buf, result)
- Added NXC API file i/o macros
    result = Read(handle, n)
    result = ReadLn(handle, n)
    result = ReadBytes(handle, len, buf)
    result = Write(handle, n)
    result = WriteLn(handle, n)
    result = WriteString(handle, str, cnt)
    result = WriteLnString(handle, str, cnt)
    result = WriteBytes(handle, buf, cnt)
    result = WriteBytesEx(handle, len, buf)
- Replaced the code underlying the ReadSensorUS (NBC) and SensorUS (NXC) API
  functions with a version which appears to be more reliable (and generic).
- Added NBC and NXC API functions to give control over reseting rotation
counters
    CoastEx(ports, reset)
    OffEx(ports, reset)
    OnFwdEx(ports, pwr, reset)
    OnRevEx(ports, pwr, reset)
    OnFwdRegEx(ports, pwr, regmode, reset)
    OnRevRegEx(ports, pwr, regmode, reset)
    OnFwdSyncEx(ports, pwr, turnpct, reset)
    OnRevSyncEx(ports, pwr, turnpct, reset)
- Added NBC and NXC constants for the "Ex" motor functions
    RESET_NONE
    RESET_COUNT
    RESET_BLOCK_COUNT
    RESET_ROTATION_COUNT
    RESET_BLOCKANDTACHO
    RESET_ALL
- Added NBC and NXC API functions which expose the PID parameters
    RotateMotorPID(ports, pwr, angle, p, i, d)
    RotateMotorExPID(ports, pwr, angle, turnpct, bsync, p, i, d)
- Added NBC and NXC API function for clearing the screen
    ClearScreen()
- Added support in the NXC SetOutput function for multiple sets of field/value
pairs
    SetOutput(ports, const field1, value1, ..., const fieldN, valueN)
- Added generic I2C read/write routine for NBC
    ReadI2CBytes(port, inbuf, count, outbuf, result)
- Added generic I2C read/write routine for NXC
    result = I2CBytes(port, inbuf, count, outbuf)
- Added NBC pseudo opcode to spawn a thread anywhere within the current thread
    start TaskName
- Added NXC start statement (ala NQC)
    start TaskName;

I haven't uploaded the Mac OSX binary yet but it will be up later today.  The
Linux and Win32 builds are up as well as the source code.

I have updated the test release of BricxCC with syntax highlighting for all the
new/modified API functions and keywords.  Get the test release from the link in
the NXT News section near the top of the BricxCC page.

All of the Write routines currently do not handle the case where you try to
write N bytes of data but the file does not have room for all N bytes.  Since
the NXT firmware does not implement a file resize algorithm at the OS level I
need to write a subroutine in NBC (and expose it at the NXC level) which can be
used to increase a file's size.  The NXT-G file access block includes code which
is called when a write fails due to running out of room. Here's the algorithm:

1. rename old file xxxx.txt to _tmpxxxx.txt
2. open read the newly renamed file
3. multiply the length * 2 if current length < 1024 otherwise add 1024 to existing length
4. open write (aka create) the old filename with newly calculated length
5. If both open read and open write are successful then copy all the data (fileread) from the renamed file (_tmpxxxx.txt) to the newly created file (xxxx.txt) at 1024 or less bytes at a time stopping if the result of FileRead is != 0 or the result of FileWrite is != 0 or the length of data read in the FileRead operations is <= 0.
6. Close the read handle
7. Close the write handle
8. Delete the temporary file

Offers of assistance will be readily accepted.

John Hansen



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR