Author Topic: Happy days are here again....with USBmicro's U4x1 and RobotBASIC V4.0.0  (Read 2473 times)

0 Members and 1 Guest are viewing this topic.

Offline SamuelTopic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 0
Hi All,

One of the very exciting new facilities in RobotBASIC V4.0.0 is the support for
USBmicro's U4x1 family of USB devices that provide the ability to do digital I/O
with a PC and lots more

In the good old days we used to be able to use simple straight forward commands
to access the PC's ports. Commands like OutPort and Inport gave the programmer
access to any port on the PC including the ISA or PCI busses and even RAM.

It became progressively harder to do anything with memory or ports or any of the
peripherals of the PC with the advent of increasingly tighter control by the OS
and the attempt to divorce a program from lower level access to system

Compilers even stopped having functions like Sound, InPort, Outport and so
forth. They do not even exist as commands any more. To be able to gain access to
anything like serial ports or parallel ports you have to earn a 10 year PhD
degree in Microsoft Systems Management and you have to pay $$$$ to get any tools
that enable you to do anything with system resources.

The PC used to be a very viable and effective Electronics Instrumentation
platform for doing I/O using the Parallel port or the Serial port or even
through the PCI bus. It was not a problem at all to use a few assembly commands
to counteract the lack of functions at the C++ level. But then along came
Windows XP and 2000 and even that ability went out of the window….excuse the

So nowadays people find it EXTREMELY hard to do anything with the PC as far as
Electronics experimentation and I/O with instrumentation.

With the advent of such versatile microcontrollers as the BS2 and Propeller,
people just forsook the PC and now only a few GURUS do any kind of I/O with a
PC. Some may argue that the PC is not even missed for such work.

Well, actually the PC has a major role to play in doing the AI work for robotics
or for GUI user interfacing and data collection and as an Internet conduit and
as a Central Hub or controller for distributed microcontrollers. I have argued
this point many times before with my concept of the Remote Computational
Platform (RCP).

With RobotBASIC a non-guru programmer can AGAIN write programs with a simple
PortOut and Inport commands to access the Parallel Port or even the PCI and ISA
bus ports. Also with RobotBASIC's serial communications (see
http://www.robotbasic.org/resources/RobotBASIC_Serial_IO.pdf) you can access
RS232 devices. Also with RobotBASIC V4.0.0 you can now even communicate across
the Internet (see http://www.robotbasic.org/resources/RobotBASIC_Networking.pdf

However, with the new generation of computers even RS232 ports and Parallel
ports went out of the window too. So what is a humble programmer to do?????
Every time we manage to open a closed window they put steel bars. And now there
are no windows altogether.

RobotBASIC to the rescue AGAIN…tadaaaa. RobotBASIC V4.0.0 has a suite of
functions that provide access to USBmicro's U4x1 family of USB digital I/O
devices (http://www.USBmicro.com).

If you miss the parallel port, The U4x1 is your solution. The U4x1 plugs into a
USB and provides 16 digital I/O lines that can be configured individually as
input or output. It is also powered by the USB power and even provides access to
this power through 2 of its pins.

So you can build circuits that are powered from the USB and you can control them
with a program in RobotBASIC that is as simple as it used to be in the days of
lore. It is even easier since you do not even need a regulated power supply to
power your circuits if you do  not require much current (< 500 mA).

The U4x1 is also a LOT MORE than just a replacement for the parallel port. It
can carry out 1-Wire and SPI communications and it can control 2 stepper motors
with independent direction, speed and stepping modes. You just tell the U4x1
through RobotBASIC's functions to start the motors and then go on with other
tasks without further need to keep stepping the signal and son. The U4x1 takes
care of all that.

The support in RobotBASIC V4.0.0 for the U4x1 is one of the most EXCITING new
features that go along with the philosophy behind RobotBASIC – to make even a
beginner programmer able to do what an advanced programmer would find
challenging, and to do it with a few lines of code in a versatile and easy to
use and learn language.

To learn about this new feature, read this document.


It has 13 project programs that utilize the U401 to do interesting electronics
I/O. One of the programs uses the UDP to send temperature readings from a U4x1
interfacing with a DS1822 over the Internet to another PC that carries out some
user interfacing and sends back actuations to get the U4x1 to drive a stepper

I think you will find that the U4x1 with RobotBASIC will open many windows for
doing interesting educational electronics I/O experiments and all in a language
that can be learnt in a few hours.

Have a look at the above document and decide for yourself.

Happy coding….with RB of course


Offline GearMotion

  • Supreme Robot
  • *****
  • Posts: 489
  • Helpful? 24
  • Two decades+ of Embedded Design

Plug in a USBmicro U421 or U401, download RobotBASIC, and run this code:


    // Discover the devices
    n = usbm_finddevices()

    // Set dir of port A of dev 0 to out
    n = usbm_DirectionA(0, 255, 255)

    // Turn on all the port's outputs
    n = usbm_WriteA(0, 255)


And you can control digital lines from your PC. It is that simple.

Offline Tesla

  • Jr. Member
  • **
  • Posts: 40
  • Helpful? 0
Hi all,

I was wondering if anyone has tried using RB v4?  What do you think?


Offline GearMotion

  • Supreme Robot
  • *****
  • Posts: 489
  • Helpful? 24
  • Two decades+ of Embedded Design
Hi all,

I was wondering if anyone has tried using RB v4?  What do you think?


I use it. I'm a bit biased. :-)

I think there is a lot that can apply to people here on this site. RobotBASIC lets you create a simulated robot in an environment that you can shape. The simulated robot has sensors that can be monitored in your code. You might be surprised at the simulated robot behavior when you first start. Something that is algorithmically logical in your mind can be simulated and oftentimes the robot behavior will help you understand the complexities of a real robot.

You can create a simulated environment like this:

In this maze you might try different algorithms with a simulated robot that will be a lot easier to test on a PC than in real life. You can also have the commands that would command a simulated robot sent out through the serial port to control a real robot.

RobotBASIC is free. It is an interpreter and will also compile your program to an executable. RobotBASIC also controls the USBmicro U401/U421 USB to LCD/SPI/stepper/1-wire input output device.

Offline Tesla

  • Jr. Member
  • **
  • Posts: 40
  • Helpful? 0

Offline LemonSkin

  • Beginner
  • *
  • Posts: 4
  • Helpful? 0
Re: Happy days are here again....with USBmicro's U4x1 and RobotBASIC V4.0.0
« Reply #5 on: October 01, 2009, 10:36:41 PM »
RobotBASIC is a cool software! I download it a month ago. But dont know how to use it because i didn't buy the book yet.
Ohya, is it the robotBASIC can program the microprocessor? And where can i get the book? Is there any ebook for free download? thanks :) :)


Get Your Ad Here