application code snippet:
for(i=0;i<tx_end;++i) //load the transmit packet array
packet_tx[i] = i+2;
err_led = OFF;
if(rc = set_tx_interval(0x28))
err_led = ON;
if(rc = set_tx_rx_mode(tr_xmit))
err_led = ON;
if(rc = set_device_id(0x11, 0x22, 0x33, id_xmit))
err_led = ON;
if(rc = set_network_id(0x00,0x00,0x00))
err_led = ON;
if(rc = set_ad_settings(0x00,0x00,0x00,0x00))
err_led = ON;
if(rc = set_network_mode(p_to_p))
err_led = ON;
if(rc = set_tx_pwr_lvl(dbm_plus5))
err_led = ON;
if(rc = send_data_buffer(no_xmit))
err_led = ON;
SCREENSHOT3.
The Hard Work is Done
Before running the API transmit application, I
commanded the laptop EmbedRF to search for the first
transmitter it could hear. Kicking off the API transmit
application resulted in the EmbedRF DesktopPRO “hearing”
the PIC’s EmbedRF and establishing a session with it. The
results of the communications session can be picked
out of the EmbedRF DesktopPRO window you see in
Screenshot 3.
According to the API transmit application code
snippet, the PIC’s EmbedRF transmit device ID is 0x112233
or 1,122,867 decimal. The PIC’s transmit device ID is
verified in Screenshot 3. The 10-byte data packet
transmitted by the PIC’s EmbedRF begins with 2 and ends
with 11. This is also backed up by the Raw Data Received
view in Screenshot 3. We disabled all of the EmbedRF’s
A-to-D inputs, so you can ignore the
Analog Data Received numbers as
they are just the hex values of the
data we entered into the data
packet. For instance, A/D 0 says it
sees 515 counts. That’s because it’s
calculating 0x0203 (515 decimal) as
an A-to-D reading. The same goes
for A/D 1, which is a result of
0x0405 or 1029 decimal.
Take a look at the EmbedRF datasheet and you’ll see
that there are many more commands than we have
discussed here. The good news is that every EmbedRF
command has a corresponding API function call; I’ve
tested all of them. So, all you have to do is put them
together to form your own unique EmbedRF application.
To ease your learning curve, I went to great lengths to
make sure that the API call arguments closely matched
the EmbedRF command descriptions in the EmbedRF
datasheet. Integrating the EmbedRF hardware is a no-brainer and with the availability of our home-brewed
EmbedRF API, bringing an EmbedRF network online is a
walk in the park. I’m sure that you won’t have any trouble
coming up with an application for the EmbedRF data
radios. See you next time! SV
Sources
Saelig —
www.saelig.com
EmbedRF;
EmbedRF Development Kit
HI-TECH Software —
www.htsoft.com
HI-TECH PICC- 18 PRO
Microchip —
www.microchip.com
PIC18LF2620; MPLAB IDE;
MPLAB REAL ICE
Make your product wireless - quickly, conveniently, and affordably. EmbedRF is
a rapidly-deployed, turn-key, networkable wireless solution for low data rate,
ultra low-power analog or digital applications. Avoid lengthy RF development
time by using EmbedRF short-range low-power wireless modules in your product
design. Notable features: RSSI output – ideal for finding nearest module or position
tracking; current levels are CR2032 coin-cell friendly (average current to <12uA
Tx/Rx); >0.25s periodicity; unique IDs avoids cross-talk; < 6mS link latency;
buffered receive data allows for other system priorities.
Full details at www.EmbedRF.com
Available from Saelig Company
www.saelig.com
info@saelig.com
SERVO 10.2008 39