carlozofjuan
New Member
Hello everyone! I am trying to resolve an issue involving my PIC18F2550 and Parallax Easy Bluetooth module.
I am using a PIC and the Easy Bluetooth module to communicate with my PC and having trouble, but I do get a response in 2 ways.
The first way, I shorted the Rx and Tx pins on the Bluetooth and was able to echo back what I have sent to it from Hyper Terminal or the Serial Communicator feature Mecanique MicroCode Studio.
The second way is I have managed to have the PIC send bytes through the Bluetooth to Hyper Terminal or Serial Communicator. With the latter, I am able to tell that the PC is receiving the correct number of bytes (if a carriage return is indeed a bit).
The problem is the characters are not the string I sent from the PIC nor do they have a pattern that reflect the string I sent. Example, I send "hello" from PIC-Bluetooth and receive something like "pxpxx" choosing "Force to 7-bit ASCII" in Hyper Terminal. Not choosing the option shows the characters from an extended set.
I did a PIC to PIC async serial communication test and found it to be working fine. One PIC sent a string out the hardware transmit async pin to the hardware receive async pin of the receiving PIC and then outputted the received string to LCD and successfully displayed the characters.
Assuming the problem is not with the PIC, or maybe just treat the PIC as if it were a STAMP for minute, I wonder what is going on when a string is transmitted from a PIC/STAMP to the Bluetooth if/how the string is altered when it leaves the Bluetooth to be received by the PC.
Just to clarify, I am using the Easy Bluetooth module that has one PCB attached to another that only has the Vdd, Tx, Rx, and Vss pins that go into my breadboard.
I'll post the code used as well as the sample program that is available as free download to accompany the Parallax Easy BT module. Any insight is very appreciated!!
Current code "eBT_hello.pbp" written in PicBasic Pro:
Is based on:
I am using a PIC and the Easy Bluetooth module to communicate with my PC and having trouble, but I do get a response in 2 ways.
The first way, I shorted the Rx and Tx pins on the Bluetooth and was able to echo back what I have sent to it from Hyper Terminal or the Serial Communicator feature Mecanique MicroCode Studio.
The second way is I have managed to have the PIC send bytes through the Bluetooth to Hyper Terminal or Serial Communicator. With the latter, I am able to tell that the PC is receiving the correct number of bytes (if a carriage return is indeed a bit).
The problem is the characters are not the string I sent from the PIC nor do they have a pattern that reflect the string I sent. Example, I send "hello" from PIC-Bluetooth and receive something like "pxpxx" choosing "Force to 7-bit ASCII" in Hyper Terminal. Not choosing the option shows the characters from an extended set.
I did a PIC to PIC async serial communication test and found it to be working fine. One PIC sent a string out the hardware transmit async pin to the hardware receive async pin of the receiving PIC and then outputted the received string to LCD and successfully displayed the characters.
Assuming the problem is not with the PIC, or maybe just treat the PIC as if it were a STAMP for minute, I wonder what is going on when a string is transmitted from a PIC/STAMP to the Bluetooth if/how the string is altered when it leaves the Bluetooth to be received by the PC.
Just to clarify, I am using the Easy Bluetooth module that has one PCB attached to another that only has the Vdd, Tx, Rx, and Vss pins that go into my breadboard.
I'll post the code used as well as the sample program that is available as free download to accompany the Parallax Easy BT module. Any insight is very appreciated!!
Current code "eBT_hello.pbp" written in PicBasic Pro:
Code:
' -----[ I/O Definitions ]-------------------------------------------------
RX Var portC.6 ' RX of the Easy Bluetooth
TX Var portC.7 ' TX of the Easy Bluetooth
CR con 13
' -----[ Constants ]-------------------------------------------------------
Baud CON 84 ' Baud set at 9600
' -----[ Variables ]-------------------------------------------------------
myByte VAR Byte ' Byte to establish connection & used for workspace
DEFINE HSER_RCSTA 90H
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1 ' ? MAY NOT BE IN PBP2.32
'DEFINE CHAR_PACING 65000
RCSTA.4=0 ' CLEAR ANY ERRORS CREN BIT
RCSTA.4=1 'START RECEPTION
RCSTA = %10010000 ' Enable serial port and continuous receive
' -----[ Initialization ]--------------------------------------------------
' The Easy Bluetooth Module is waiting for a Byte to establish connection;
' press any key in the TOP window pane of the DEBUG or PST to do this.
PAUSE 250 ' Waits 5 seconds
main:
hserin 1000, main, [myByte] ' Waiting for byte
myByte = 0 ' Clear the byte value
' -----[ Program Code ]----------------------------------------------------
hserout [ "Hello", CR] 'CR carriage return is 13
Code:
' =========================================================================
'
' File...... Easy Bluetooth _ Hello.bs2
' Purpose... Displaying uni-directional communcation with a PC & Bluetooth
' Author.... Technical Support & Education
' E-mail.... support@parallax.com
' Started... Jan 16th 2009
' Updated... April 1st 2009
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================
'
'
' -----[ Program Description ]---------------------------------------------
'
' This program displays a bi-directional communication between the Easy Bluetooth
' and a Terminal Window.
'
' -----[ Revision History ]------------------------------------------------
'
' revised 4/1/09 for the new Easy Bluetooth module
'
' -----[ I/O Definitions ]-------------------------------------------------
RX PIN 2 ' RX of the Easy Bluetooth
TX PIN 0 ' TX of the Easy Bluetooth
' -----[ Constants ]-------------------------------------------------------
Baud CON 84 ' Baud set at 9600
' -----[ Variables ]-------------------------------------------------------
myByte VAR Byte ' Byte to establish connection & used for workspace
' -----[ Initialization ]--------------------------------------------------
' The Easy Bluetooth Module is waiting for a Byte to establish connection;
' press any key in the TOP window pane of the DEBUG or PST to do this.
PAUSE 250 ' Waits 1/4 second
SERIN RX, Baud, [myByte] ' Waiting for byte
myByte = 0 ' Clear the byte value
' -----[ Program Code ]----------------------------------------------------
SEROUT TX, Baud, ["Hello", CR]