Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the titan-security domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home1/kennydai/public_html/vesnam/NXTrobot/wp-includes/functions.php on line 6131

Warning: Cannot modify header information - headers already sent by (output started at /home1/kennydai/public_html/vesnam/NXTrobot/wp-includes/functions.php:6131) in /home1/kennydai/public_html/vesnam/NXTrobot/wp-includes/feed-rss2.php on line 8
NXT – Robot & I http://www.vesnam.com/NXTrobot How I decided to play with robots Mon, 21 Oct 2013 23:14:33 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 NXT micro-computer http://www.vesnam.com/NXTrobot/nxtmc/ http://www.vesnam.com/NXTrobot/nxtmc/#respond Thu, 06 Sep 2012 20:09:55 +0000 http://www.vesnam.com/NXTrobot/?p=1 Continue reading ]]> NTX brickThe NXT™ brick is a micro-computer. As any other computer, it needs an operating system (OS) to communicate with the hardware and to allow programs to run. Different OSs are developed and optimized for different types of computers. The NXT™ micro-computer runs the NXT™ OS. Among other things, the NXT™ OS provides a set of commands and functions that define how NXT™ (i.e., the robot) communicates with motors, sensors, and the NXT™ screen. It also defines the required structure and properties of programs that will be run on the NXT™. As any other machine, at its lowest level NXT™ requires all programs to be represented in the form of the machine language. All commands in the machine language are represented as sequences of 1 and 0, e.g., 10101100101. As such they correspond to electrical signals: 1 – signal/electricity on and 0 – signal/electricity off, that can be directly interpreted by the computer. However, while easily understood by computers, machine language is not very intuitive for humans (because it consist entirely of 1s and 0s) and it is very inefficient (or almost impossible) for programmers to use it.

Knowing that NXT™ will represent the brain of any robot we make, as well as that this brain does not come with embedded intelligence or ability to learn, each robot we make will be as smart as we program it to be. Programming in the machine language probably wouldn’t take us too far. Luckily, there are easier ways to program NXT™. This does not mean that suddenly NXT™ can understand something else than 1s and 0s; it means that there exist other computer programs (compilers and interpreters) that can translate programming languages that are more intuitive for humans into the machine language. There are quite a few programming languages (and compilers) that can be used for NXT™ programming (here is a nice summary) and NXT comes with a LEGO® provided bytecode interpreter.

Here, I will focus on one of the high-level NXT™programming languages, called NXC (Not eXactly C). The NXC is very similar to a standard C programming language, with some limitations that reflect different capabilities of NXT™ OS. The most important part of the NXC is the NXC Application Programming Interface (API) that describes the system functions, constants, and macros that can be used by programs (this is what we’ll use to work with sensors, motors, and outputs). To write a NXC program, you don’t need any fancy editor, a simple text editor is enough.

To compile NXC programs  we will use the NBC compiler (available for multiple platforms and can run under both 32-bit and 64-bit OS.). This compiler translates text-based source NXC programs into NXT™ bytecodes; these bytecodes are then executed on NXT™ with the help of the NXT™ LEGO®  bytecode interpreter. A nice feature of NBC compiler is that it automatically includes NXC APIs when compiling a program. The NBC compiler installation is very simple:

  1. Download the latest NBC release (zip or tgz file, depending on the platform) from http://bricxcc.sourceforge.net/nbc/, and
  2. Unpack the downloaded file.

To find more up-to-date information and documentation for NXC, check http://bricxcc.sourceforge.net/nxc/.

 

]]>
http://www.vesnam.com/NXTrobot/nxtmc/feed/ 0