Shop OBEX P1 Docs P2 Docs Learn Events
Possible causes for failure of our project? Any expert advice? — Parallax Forums

Possible causes for failure of our project? Any expert advice?

eliz6sigmaeliz6sigma Posts: 3
edited 2006-12-05 13:23 in BASIC Stamp
Hi, I am currently doing a school project which involve the use of an eb500, sound module and BASIC stamp II attached to a BOE.
We are using it to·communicate with the handphone. Initially,the phone could detect the eb500 and the eb500 LED light up.
However, after we connected the sound module, the eb500 could not detect the phone.We suspect something is wrong with the eb500 but we can't conclude that. Below is our program:
This program demonstrates how to get the address of the eb500 serial
' Bluetooth module.
'
' Instructions
' ============
' 1. Verify that the eb500 module is connected properly to the AppMod
'··· header of the developent board.
' 2. Modify the connection logic to use the correct Bluetooth Address.
' 3. Compile and run this program.
'
' **************************************************************************
'{$STAMP BS2}
'Wait for the eb500 radio to be ready
PAUSE 1000

'Connect to the remote device
SEROUT 1,84,[noparse][[/noparse]"con 00:0C:84:00:05:29",CR]
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]

'Wait for the connection to be established and switch to data mode
WaitForConnection:
IF IN5 = 0 THEN WaitForConnection
HIGH 6
PAUSE 300

'Wait for 20 seconds
PAUSE 20000

'Switch to Command Mode
LOW 6
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]

'Disconnect from the remote device
SEROUT 1,84,[noparse][[/noparse]"dis",CR]
SERIN 0,84,[noparse][[/noparse]WAIT(CR,">")]
May I know what may be the possible causes for failure? A million thanks!!
Best regards,
Elizabeth

Comments

  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2006-12-04 20:51
    Elizabeth--

    I know nothing about the eb500 and not too much about PBasic! However, I do not think the SEROUT command (SEROUT 1,84,[noparse][[/noparse]"con 00:0C:84:00:05:29",CR]) in your program is correct. I believe the quotation marks may be a problem. Check the format of the command in both the syntax manual and the IDE help.

    Good luck!

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • eliz6sigmaeliz6sigma Posts: 3
    edited 2006-12-05 02:03
    I see.. I'll try that out! Thanks!!yeah.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.SateliteTvforPC.com

    ·
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2006-12-05 02:06
    Elizabeth--

    Since I am involved in education and REALIZE what this time of the semester means to you, using this post I will bump your request back up to the top. The correct syntax for the SEROUT command is a simple thing, I wish I could answer it decisively for you. But, I am to ignorant of PBasic to do so.

    There are a LOT of folks on this board not so ignorant!

    In the meantime, I will go downstairs and see if I can determine anything more from the syntax manual.

    Best of luck.

    --Bill
    ps Of course, the SEROUT command may not be the problem or it may be only ONE of the problems. That's how it goes in the code-cutter world.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2006-12-05 02:47
    Elizabeth--

    Re: SEROUT 1,84,[noparse][[/noparse]"con 00:0C:84:00:05:29",CR]

    I will try to disect your SEROUT command. Remember that I am not an expert--I am sure you know more about PBasic than I; however, I do have a LOT of experience as a programmer--and that even if I am correct there may be more wrong with your program than the SEROUT command.

    It appears to me that you are using PIN 1 as the I/O pin to transmit serial data and that you are choosing to communicate at 9600 baud, because you set that placeholder parameter to 84, which places the BS2, BS2e, and BS2pe in the 8-bit, no-parity, true mode. (Are you using one of those processors? If you are not, then your SEROUT statement will definitely not work.)

    The last parameter in your SEROUT command appears (to me) to be the problem. The syntax of your particular command makes that last parameter the [noparse][[/noparse]outputData] parameter (see page 415 of the BASIC Stamp Command Reference). In other words, it passes no instructions to the Stamp, just data. It might as well be [noparse][[/noparse]"Hello", CR].

    Specifically, the problem (again, to me) appears to be "con 00:0C:84:00:05:29". What data are you trying to send? Remember, this parameter does not setup the SEROUT command; it outputs the data you are tyring to send. Enclose the data you are trying to send in quotation marks in place of "con 00:0C:84:00:05:29".

    The next statement SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)] looks ok to me, but I am simply not sure about the ',CR' part. You might simply eliminate it and see if you learn something by doing so.

    In the meantime, perhaps a REAL PBasic programmer will respond to your post.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • FranklinFranklin Posts: 4,747
    edited 2006-12-05 02:50
    What happens if you remove the sound module? It's possible your power source is being taxed to the limit and can't support all you have attached.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Sarten-XSarten-X Posts: 32
    edited 2006-12-05 11:19
    (Bear in mind that i've not used the eb500 module. This is just what I see reading the documentation)

    Absolutely first, try removing the sound module. If you broke it by adding something, removing that something might fix it.

    Assuming that doesn't work:
    The SEROUT command looks fine, as far as syntax goes. It's sending out a string, telling the eb500 to connect ("con") to a device. The 12 hexadecimal numbers is a device address telling the eb500 which device to connect to. Since the address in your program is the same as the one in the documentation, I doubt it's right. To find devices near the eb500, send the command "lst visible", wait for ("ACK",cr), then retrieve the next 17 bytes. Those bytes are the address of a nearby device (refer to page 107 of the manual).

    Off the top of my head, I think the code would be something like:

    'do initialization here
    Address VAR Byte(18) 'This is an array to hold the string the eb500 sends. It's a little big, purely for the sake of being big.

    serout 1,84,[noparse][[/noparse]"lst visible",cr] 'ask for the address
    SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)] ' wait for the eb500 to begin sending
    SERIN 0,84,[noparse][[/noparse]address] 'get the first device address
    serout 1,84,[noparse][[/noparse]cr] 'stop eb500 from sending more

    ' We now have the device address, stored in RAM. Try using DEBUG to see what you get.

    ' Now let's connect to the device
    serout 1,84,[noparse][[/noparse]"con ",address,cr] 'send "con " followed by the address we found. Note that there is a space between the n and "
    SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)] 'Wait for the eb500 to connect
    'do the rest of your program
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2006-12-05 13:23
    Elizabeth--

    Thanks to several folks, especially Sarten-X, we both learned something!

    Good luck on your project.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
Sign In or Register to comment.