|Online Development Notebook > Index > U4x1 Application Notes > App17: REALBasic OSX Temperature|
App17: REALBasic OSX Temperature
Provide an example of using REALBasic to use a U4x1 with OSX.
The capabilities of the U4x1 allows it to interface to 1-wire temperature sensors. Dallas DS1822 sensors, specifically for this example. Other similar sensors could be used with minor code changes. This example assumes that there is a U401, U421, or U451 device on the Mac USB port, and that the pins of port 1 are connected to DS1822 sensors.
REALBasic is used, along with a package called MonkeyBread, to make this application. The MonkeyBread plug-in costs $28 at the time of this writing for the USB plug-in. This gives the REALBasic code writer a leg up on Mac USB interfacing.
The first task is to initialize the U4x1 structure. This looks for the first U4x1 and then connects to it. It also installs a callback for the reply messages.
Next is opening the specific U4x1 to communicate with, and grab a bunch of the device data.
Sending a USB message depends on more of the MonkeyBreak plug-in support. Here is code covering the transfer of data to the U4x1:
The Callback routine that stores the USB message content into a set of bytes:
These are some parts of a state machine that sends messages to the U4x1 device and processes the device replies:
The REALBasic code cycles through a large state machine scanning each of the DS1822 devices for temperature and putting the information in text boxes.
I cross-compile, so that is why this development window looks very much unlike OSX. :-)
|Hardware: U401 USB Interface U421 USB Interface U451 USB Interface|
Programming: USBm DLL Programming Download Files
Application Notes: U4x1 Application Notes Misc Applications and Information FAQ
While every effort has been made to make sure that the information posted on this site is correct, the author can not be held liable for any damages whatsoever for losses as a result of the application of this information. Use this information at your own risk.
USBmicro can design your custom and semi-custom USB product. Email about USB design can be directed to " Robert " at usbmicro.com.
Copyright © USBmicro, L.L.C., 2002-2010