background image

EmbeddedBlue 500 

 

13

 

 

Copyright ©2003 A7 Engineering, Inc. 

BASIC Stamp Application Debugging 

When debugging your BASIC Stamp application that uses an eb500 it is important that the 
BASIC Stamp application and the eb500 are in sync. When the BASIC Stamp Editor begins 
the downloading process the BASIC Stamp is reset; however, this reset does not reset the 
eb500. This can cause an existing application on the BASIC Stamp to begin executing, 
which can lead to a situation where the new application and the eb500 are not in sync. It is 
possible that the eb500 could be in Data Mode or in an unpredictable command mode state, 
due to the execution of the existing BASIC Stamp application. Therefore, during the 
application debugging process, it is recommended that the following code be inserted at the 
beginning of your BASIC Stamp application, before you read or set any I/O points or issue 
any commands to the eb500. 

‘************************************************************* 

IF in5 = 0 THEN ClearCmd 

DEBUG “eb500 Connected (in Data Mode)”,CR 

‘Switch to Command Mode 

LOW 6 

SERIN 0,84,[WAIT(CR,”>”)] 

‘Disconnect from the remote device 

SEROUT 1,84,[“dis”,CR] 

SERIN 0,84,[WAIT(CR,”>”)] 

GOTO Start 

ClearCmd: 

 

DEBUG “eb500 in Command Mode”,CR 

 

‘Issue a carriage-return to clear any commands 

 SEROUT 

1,84,[CR] 

 SERIN 

0,84,[WAIT(“>”)] 

‘************************************************************* 

Summary of Contents for eb500

Page 1: ...EmbeddedBlue 500 User Manual...

Page 2: ...ademark of Parallax Inc Bluetooth and the Bluetooth logo are registered trademarks of the Bluetooth SIG Windows is a registered trademark of Microsoft Corporation Other brand and product names are tra...

Page 3: ...cation 25 Connecting a PC with a DBT 120 to a BOE 28 Connecting a BOE to a PC with a DBT 120 32 Connecting an iPAQ h1940 to a Board of Education 35 Connecting a Board of Education to an iPAQ h1940 37...

Page 4: ...scape Character 79 Set Flow Control 80 Set Link Timeout 81 Switch to Command Mode 82 Version 83 eb500 Error Codes 84 Technical Specifications 85 Operating Parameters 85 Dimensions 86 Pinout Diagram 87...

Page 5: ...ure 6 SumoBoard 19 Figure 7 Super Carrier Board 20 Figure 8 eb500 Bluetooth Address Output 23 Figure 9 iPAQ Bluetooth Authorization Request Dialog 39 Figure 10 HyperTerminal Input and Debug Output 47...

Page 6: ...6 User Manual Copyright 2003 A7 Engineering Inc Table of Tables Table 1 eb500 Error Codes 84 Table 2 eb500 Operating Parameters 85 Table 3 eb500 Dimensions 86 Table 4 eb500 Pinout Description 87...

Page 7: ...eb500 modules or an eb500 module and a standard Bluetooth v1 1 device Devices can be dynamically discovered and connected in an ad hoc manner Manual Conventions Below is a list of typographical conve...

Page 8: ...K string is returned After either the ACK or NAK a carriage return CR character is returned When a prompt CR followed by a is returned it means that the eb500 radio is in the idle state and is waiting...

Page 9: ...he eb500 to the Factory Default Settings The eb500 module can be reset to the factory default settings by shorting Pin 8 and Pin 9 and then applying power to the eb500 module Switching between Data Mo...

Page 10: ...Mode PAUSE 2000 SEROUT 1 84 SERIN 0 84 WAIT CR DEBUG In Command Mode CR Get the eb500 Bluetooth Address SEROUT 1 84 get addr CR SERIN 0 84 WAIT ACK CR Read the local address from the get command SERIN...

Page 11: ...rol I O line is preferred as it is faster than the serial method This application is available in electronic form on the accompanying CD in the Samples folder in the file CmdModeHard bs2 STAMP BS2 szD...

Page 12: ...et command SERIN 0 84 STR szData 17 SERIN 0 84 WAIT CR szData 17 0 DEBUG STR szData 17 CR Return to Data Mode HIGH 6 PAUSE 50 DEBUG In Data Mode CR SEROUT 1 84 My Bluetooth address is STR szData CR Sw...

Page 13: ...not in sync It is possible that the eb500 could be in Data Mode or in an unpredictable command mode state due to the execution of the existing BASIC Stamp application Therefore during the application...

Page 14: ...rds supporting the Parallax AppMod header When inserting the eb500 module to any of the supported Parallax boards it is important that Pin 1 of the eb500 module marked with a white dot and a square Fi...

Page 15: ...nsert Pin 1 of the eb500 module marked with a white dot and a square into the VSS pin of the AppMod header www stampsinclass com Reset STAMPS CLASS in Board of Education Pwr 9 Vdc Battery 6 9VDC Sout...

Page 16: ...module into the Basic Stamp Activity Board AppMod header assure that you insert Pin 1 of the eb500 module marked with a white dot and a square into the VSS pin Pin 1 of the AppMod header Pwr Reset St...

Page 17: ...quare into the VSS pin of the AppMod header P40 Demo Board Power 2002 X6 JU2 Reset 6 9 VDC 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 2 3 4 5 6 7 8 9 10 11 12 1...

Page 18: ...on with the eb500 module On the Javelin Stamp Demo Board the AppMod header is labeled X1 Figure 5 When inserting the eb500 module into the Javelin Stamp Demo Board AppMod header assure that you insert...

Page 19: ...t connection with the eb500 module On the SumoBoard the AppMod header is labeled X10 Figure 6 When inserting the eb500 module into the SumoBoard AppMod header assure that you insert Pin 1 of the eb500...

Page 20: ...rd AppMod header assure that you insert Pin 1 of the eb500 module marked with a white dot and a square into the VSS pin of the AppMod header Reset Pwr Need Tech Support Send email to stamptech paralla...

Page 21: ...ocess of establishing a connection between an eb500 inserted into a Board of Education board and an eb500 inserted into a SumoBoard board To perform this exercise as documented you will need a Board o...

Page 22: ...pMod header of the Board of Education board assuring that Pin 1 of the eb500 module is inserted into the VSS pin of the AppMod header 2 Insert an eb500 module into the AppMod header of the SumoBoard b...

Page 23: ...p Editor on the File menu click New This will create a new project window within the BASIC Stamp Editor 2 Enter the following program code into the editor replacing the Bluetooth device address with t...

Page 24: ...oth device waits twenty seconds switches back to command mode and then disconnects from the remote device 3 On the File menu click Save As 4 In the File name box enter a file name to which to save the...

Page 25: ...e is inserted into Pin 1 of the header on the eb600 PC Adapter 2 Connect the eb600 PC Adapter to a serial port on the PC using the provided straight through serial cable The PC serial port must be ava...

Page 26: ...ped characters locally checkbox 17 Check the Append line feeds to incoming line ends checkbox 18 Check the Wrap lines that exceed terminal width checkbox 19 Click OK This will return to the Properties...

Page 27: ...the address type lst at the prompt and press the return key Example lst ACK 00 0C 84 00 07 D7 2 Using HyperTerminal establish a connection with the eb500 that is connected to the Board of Education bo...

Page 28: ...next exercise will demonstrate establishing a connection from a remote eb500 to the PC The D Link DBT 120 Bluetooth USB Adapter software must be fully installed prior to establishing a connection The...

Page 29: ...ices The A7 Serial Port service will be shown in the window 4 Select A7 Serial Port and click Connect to this service This will establish a connection from the PC to the eb500 on the Board of Educatio...

Page 30: ...in the previous step 5 Click OK This will display the Properties dialog 6 In the Bits per second dropdown select 9600 7 In the Data bits dropdown select 8 8 In the Parity dropdown select None 9 In the...

Page 31: ...ion from the PC to the eb500 on the Board of Education using HyperTerminal This step relies on the connection information created previously in Step 3 1 On the Call menu click Call This will establish...

Page 32: ...application such as HyperTerminal must open the COM port associated with the connection established from the remote device In the Communications section we will step through this process The D Link DB...

Page 33: ...rt to the PC 3 Open the BASIC Stamp Editor 4 Enter the following program code into the editor replacing the Bluetooth device address with the device address of the PC which we obtained from the Hardwa...

Page 34: ...the program just created For example ConnectPC bs2 7 Click Save Step 4 Connect the eb500 on the Board of Education to the PC 1 Apply power to the Board of Education board Power can be applied by attac...

Page 35: ...the AppMod connector of the Board of Education board assuring that Pin 1 of the eb500 module is inserted into the VSS pin of the AppMod header 2 Apply power to the Board of Education board Power can b...

Page 36: ...rial Port 2 Select Connect This will establish a connection with the eb500 on the Board of Education board The Connection Status LED Figure 1 on the eb500 module will turn on when a connection is esta...

Page 37: ...he Settings dialog 2 Tap the Accessibility tab and note the Address shown in the Device Identification section of the dialog The device address will be used in the BASIC Stamp application developed in...

Page 38: ...application establishes a connection with the remote Bluetooth device waits twenty seconds switches back to command mode and then disconnects from the remote device On the h1940 model of the iPAQ the...

Page 39: ...taching a 9 Volt battery or the AC Adapter provided by Parallax 5 Using the Basic Stamp Editor on the Run menu click Run Depending on your current iPAQ Bluetooth configuration the Authorization Reques...

Page 40: ...bot We will program the SumoBot to use its infrared sensors to follow an object and then transmit its movements to the Boe Bot The Boe Bot will use the received information to mimic the movements of t...

Page 41: ...Variables irBits VAR NIB irLeft VAR irBits Bit1 irRight VAR irBits Bit0 lastIr VAR NIB bBuffer VAR BYTE 4 bErrorCode VAR BYTE Initialization Wait for the eb500 radio to be ready PAUSE 1000 Connect Co...

Page 42: ...t Turn_left Move_Fwd Move_Fwd SEROUT 1 84 3 PULSOUT LMotor LFwdFast PULSOUT RMotor RFwdFast GOTO Main Turn_Right SEROUT 1 84 1 PULSOUT LMotor LFwdFast PULSOUT RMotor RRevFast GOTO Main Turn_Left SEROU...

Page 43: ...5 Click Save Step 2 Create a Monkey Do Application for the Boe Bot In this step we will create a BASIC Stamp application that will receive information from the remote SumoBot and perform movements bas...

Page 44: ...n Wait for a command SERIN 0 84 DEC1 CmdData Process the command BRANCH CmdData Hold Turn_Right Turn_left Move_Fwd If the command was invalid just loop again GOTO Main Move_Fwd PULSOUT LMotor LFwdFast...

Page 45: ...ck Close 6 Disconnect the power from the SumoBoard board 7 Disconnect the SumoBoard board serial port from the PC 8 Click the MonkeyDo bs2 tab in the BASIC Stamp Editor 9 Connect the Board of Educatio...

Page 46: ...this exercise Step 1 Transmit Data from the PC to the BASIC Stamp In this step we will create a BASIC Stamp application to read data from the eb500 and display the data in the BASIC Stamp Editor Debu...

Page 47: ...the PC In this step we will create a BASIC Stamp application to send data out the eb500 to the PC where we will use HyperTerminal to display the data received by the eb500 module attached to the eb600...

Page 48: ...84 00 07 D8 4 Using the BASIC Stamp Editor on the File menu click New This will create a new project window within the BASIC Stamp Editor 5 Enter the following program code into the editor replacing...

Page 49: ...b500 to establish a connection with the device specified Once a connection is established the eb500 is in data mode which causes further calls to SEROUT to be sent to the remote device 6 On the File m...

Page 50: ...50 User Manual Copyright 2003 A7 Engineering Inc Figure 11 HyperTerminal Output Hello World...

Page 51: ...a over the connection Step 2 of this exercise demonstrates establishing a connection from the eb500 on the Board of Education to the PC and then transmitting data over the connection The D Link DBT 12...

Page 52: ...k read by the BASIC Stamp application and then displayed in the debug window Step 2 Transmit Data from the BASIC Stamp to the PC In this step we will create a BASIC Stamp application to send data out...

Page 53: ...Bluetooth Configuration dialog click Cancel This will close the Bluetooth Configuration dialog 9 Close the My Bluetooth Places window 10 Open HyperTerminal This will display the Connection Descriptio...

Page 54: ...click Properties This will display the Properties dialog 23 On the Settings tab click ASCII Setup This will display the ASCII Setup dialog 24 Check the Send line ends with line feeds checkbox 25 Chec...

Page 55: ...R DEBUG Disconnected CR The BASIC Stamp application establishes a connection with the remote eb500 device waits for the connection to be established then transmits Hello World ten times switches back...

Page 56: ...ick Run This will display the Download Program dialog while downloading the program to the BASIC Stamp After the download is complete the BASIC Stamp application will transmit Hello World over the wir...

Page 57: ...lay the data in the BASIC Stamp Editor Debug window We will then download and run the application The application for the iPAQ is too verbose to include in this manual therefore the application along...

Page 58: ...the Settings dialog 10 Scroll to the right tap the Serial Port tab and note the Outbound COM port The Outbound COM port will be used in the iPAQ application later in this step 11 Download the Hello Wo...

Page 59: ...Editor Debug window 17 Tap the Disconnect button to close the Bluetooth connection Step 2 Transmit Data from the BASIC Stamp to the iPAQ In this step we will create a BASIC Stamp application to send d...

Page 60: ...ata PAUSE 1000 wait for 1 second NEXT I O Line 6 allows us to switch to Command Mode OUTPUT 6 Switch to Command Mode LOW 6 SERIN 0 84 WAIT CR Disconnect from the remote device SEROUT 1 84 dis CR SERIN...

Page 61: ...7 Scroll to the right tap the Serial Port tab and note the Inbound COM port The Inbound COM port will be used in the iPAQ application later in this step 8 Download the RXEB500 Pocket PC application to...

Page 62: ...tion will establish a connection with the iPAQ Depending on your current iPAQ Bluetooth configuration the Authorization Request Dialog may appear Figure 9 If this dialog appears tap Accept to accept t...

Page 63: ...he syntax of the command is correct the eb500 returns an ACK string not the ACK character 0x06 otherwise a NAK string is returned Following the ACK or NAK string is a carriage return 0x0D character If...

Page 64: ...r the ACK CR response from the eb500 then waits for the error string or the prompt to be returned from the eb500 It then checks the first bye of the data returned to determine if an error has occurred...

Page 65: ...It can take up to four seconds to cancel the connection request Syntax con address timeout CR Parameters address The Bluetooth address of the remote device The Bluetooth device address is the 48 bit I...

Page 66: ...66 User Manual Copyright 2003 A7 Engineering Inc Disconnect The disconnect command closes the connection with the remote Bluetooth device Syntax dis CR Example dis CR ACK CR...

Page 67: ...mand returns the address of the local eb500 module Syntax get addr CR Returns The unique address of the local eb500 module used to identify the module when making connections In Bluetooth terminology...

Page 68: ...mode setting of the local eb500 module Syntax get con CR Returns The current connectable mode setting of the local eb500 module In Bluetooth terminology the returned value reflects the current settin...

Page 69: ...ode setting of the local eb500 module Syntax get dis CR Returns The current discoverable mode setting of the local eb500 module In Bluetooth terminology the returned value reflects the current setting...

Page 70: ...c Get Escape Character The get escape character command returns the current character used in the Switch to Command Mode command to instruct the eb500 to leave Data Mode and enter Command Mode Syntax...

Page 71: ...eb500 is configured for no flow control and both the RTS and CTS lines are configured as high Z inputs A BASIC Stamp application is free to use these lines as normal I O without regard to the eb500 h...

Page 72: ...the connection has been broken if the remote device disappears This timeout also has an effect on how robust the communications link is to interference If this value is set very low the link may be lo...

Page 73: ...sting of the eb500 commands and a brief description of each command Syntax hlp command CR Parameters command The eb500 command name con dis get lst set and ver for which to return help Examples hlp CR...

Page 74: ...t is reached by sending an additional carriage return to the eb500 Syntax lst timeout CR Parameters timeout An optional parameter used to abort the list request after the specified number of seconds T...

Page 75: ...Blue 500 75 Copyright 2003 A7 Engineering Inc Return to Data Mode The return to data mode command instructs the eb500 to enter Data Mode when there is an active connection Syntax ret CR Example ret CR...

Page 76: ...Parameters rate The baud rate value Valid baud rates are 9600 default 19200 38400 57600 115200 and 230400 Once the baud rate has been set applications such as HyperTerminal must also be configured to...

Page 77: ...devices In Bluetooth terminology this command controls the setting for page scan Syntax set con on off CR Parameters on Configures the eb500 so that other Bluetooth devices may establish a connection...

Page 78: ...terminology this command controls the setting for inquiry scan Syntax set dis on off CR Parameters on Configures the eb500 so that other Bluetooth devices may detect the presence of this eb500 off Co...

Page 79: ...in the Switch to Command Mode command to instruct the eb500 to leave Data Mode and enter Command Mode The factory default escape character is the plus sign Syntax set escchar character CR Parameters...

Page 80: ...flow control and both the RTS and CTS lines are configured as high Z inputs This allows a BASIC Stamp application to use these lines a normal I O without regard to the eb500 hardware Configures the eb...

Page 81: ...ue is set very low the link may be lost if interference picks up for several seconds such as when a heavy burst of 802 11 traffic is encountered In Bluetooth terminology this command controls the sett...

Page 82: ...pe character The factory default escape character is the plus sign A different escape character can be set in the eb500 by using the Set Escape Character command Example con 00 0C 84 00 07 D7 CR ACK C...

Page 83: ...version of the local eb500 module Syntax ver all CR Parameters all An optional parameter used to return the build number model number serial number and manufacturer Example ver all CR ACK CR Firmware...

Page 84: ...the remove device requires Bluetooth security for a serial port connection 2 Connection attempt failed This error occurs when attempting to connect with an invalid Bluetooth address or a device that i...

Page 85: ...VDC Current Consumption 115 2kbps data transfer 35mA 38 4kbps data transfer 30mA 9 6kbps data transfer 25mA connected and idle 8mA no connection 3mA Interfaces 5V logic level UART or RS232 serial w op...

Page 86: ...he dimensions of the eb500 are shown below in Table 3 Please reference Figure 15 to locate the referenced dimension on the eb500 Figure 15 eb500 Dimensions Dimension inches mm A 2 7 68 B 2 4 61 C 1 3...

Page 87: ...iagram Pin Name Pin Type Description VSS 1 2 GND Ground RX 3 TTL output UART data output TX 4 CMOS TTL input UART data input RX Flow RTS 5 CMOS TTL input weak pull down Signaled high to stop module da...

Page 88: ...ting using your PC since the PC is capable of communicating at 115200 baud Question How do I obtain eMbedded Visual C 4 0 to develop Pocket PC applications Answer The eMbedded Visual C 4 0 development...

Page 89: ...ing in the eb500 is set to on Question I have Bluetooth Authentication Security enabled on my iPAQ Why am I unable to connect my iPAQ to the eb500 on my Board of Education board Answer Currently the e...

Page 90: ...Email support parallax com Sales Email sales parallax com Parallax Inc 599 Menlo Drive Suite 100 Rocklin Ca 95765 888 512 1024 main 916 624 8003 fax A7 Engineering has created the EmbeddedBlue product...

Reviews: