CircuitGizmos

Electronic Products for Creative Minds

  • Home
  • Gizmo Store/Products
  • Documentation/Datasheets
  • Projects/Libraries
  • GizmoBlog
  • Services/Contact
    • Design
    • Contact Gizmo!
  • Your Gizmo Cart
    • Your Account

November 2, 2009 by robert Leave a Comment

If your language can call a DLL, you can use the U401 or U421

On the Liberty BASIC Community Forum was a posting asking:

Has anyone used LB to interface to USBmicro I/O modules see http://usbmicro.com/
RobotBasic & VB provide this functionality

The moderator “Rod” replied:

If I take the short VB example listed on the web page it would convert like this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
'open the .dll
Open "USBm.dll" for dll as #micro
 
'find device
CallDll #micro, "USBm_FindDevices", w as long, Result as long
if w then
    print "Device number ";w;" is open"
else
    print "Device not found"
    end
end if
 
'initiate the ports on device w
CallDll #micro, "USBm_InitPorts", w as long, Result as long

Easy peasy.

Filed Under: Uncategorized Tagged With: programming, u401, u421

July 14, 2009 by robert Leave a Comment

Delphi Interface Example

A customer was kind enough to share an example project for the U401/U421 centered around the 1-wire temperature device. The project was written in Delphi and is available for download (source and executable) here: https://www.circuitgizmos.com/files/u401delphi.zip

You can get the DS1822 from CircuitGizmos along with the U401 USB Interface and the U421 USB interface

2009-07-14_180854

Program and example features:
Port A is INPUTPort
A.7 is set for DS1822.
Port B is OUTPUT
Programmable scan rate
Programmable temperature threshold controls PortB.1
Option to log data to a local file
Optional choice of units
On-Demand temperature read

The example code is very readable, even if you don’t know object pascal. You can see just in this small part of code that reading a 1 wire device only takes resetting the bus and a few read and write commands. Easy-peasy.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<span style="color: #008000;">
    // Reset device
    USBm_Reset1Wire( dev, pin );
 
    // Write "SkipRom" and "Conversion"
    USBm_Write1Wire( dev, $CC);
    USBm_Write1Wire( dev, $44);
    sleep(100);
    pin := $7;
    USBm_Reset1Wire( dev, pin );
 
    // Write "SkipRom" and "Read Scratch Pad"
    USBm_Write1Wire( dev, $CC);
    USBm_Write1Wire( dev, $BE);
 
    // Process Family Code "22" (DS18B22)
    // Read two bytes of temperature
    result := USBm_Read1Wire( dev, data[0]);
    temp := inttostr(data[1]);
    val(inttostr(data[1]),T2,result);
    comb :=  T2;
</span>

This example code is provided AS-IS without warranty for distribution as example coding for the U4x1 in Delphi. It is easy enough to implement similar projects using Visual Basic, C, REALbasic, or the free RobotBASIC.

Enjoy!

Filed Under: Uncategorized Tagged With: 1-Wire, Delphi, programming, u401, u421

June 9, 2009 by robert Leave a Comment

New RobotBASIC U401/U421 interface guide

Guest blog by Samuel Mishal

Hi All,

One of the very exciting new facilities in RobotBASIC V4.0.0 is the support for USBmicro’sU4x1 family of USB devices that provide the ability to do digital I/O with a PC and lots more!
See this guide: http://www.robotbasic.org/resources/RobotBASIC_USBmicro_U4x1.pdf

2009-06-09_124812

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 resources.

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 pun.

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 (seehttp://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:http://www.robotbasic.org/resources/RobotBASIC_USBmicro_U4x1.pdf

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
motor.

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 learned in a few hours.

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

Happy coding….with RB of course!

Samuel

Filed Under: Uncategorized Tagged With: programming, RobotBASIC, u401, u421

  • 1
  • 2
  • 3
  • …
  • 5
  • Next Page »

A Ton of Documentation

Open all | Close all

Projects made by Gizmo, Friends, and Members

open all | close all

Recent GizmoBlog Musings

  • Altair 8800 using a ColorMax!
  • Re-energizing the ColorMax, Pt. 3

Visit us!

  • Facebook

Electronic Products for Creative Minds

CircuitGizmos is your source for electronic products that help you create your embedded projects. Here at CircuitGizmos.com you will find a friendly store filled with creative products and all of the documentation that you need to use these gizmos.

We create devices that we believe make electronics fun, but we also know that our products are used for professional designs. For decades we have designed products for commercial, military, and medical industries. Our gizmos here are great for engineers and hobbyists alike.

Copyright © 2008+ CircuitGizmos, L.L.C. All rights reserved

Image already added

Recently Viewed Products

Copyright © 2021 · Generate Pro Theme on Genesis Framework · WordPress · Log in