Help with bluetooth...


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    Oct 2008
    Posts
    65

    Default

    Hi to all, I change the codes and Port pin setup, at this time I used the SERIN and SEROUT...
    Code:
    include "modedefs.bas"
    B2 var byte 
    pause 500
    
    start:   
    
           serin 0,T9600,B2 ''''''''''''''''''''''''''' PortB.0 as my recieve pin from bluetooth Tx
           Serout PORTC.6, T9600, [#B2,10,13] '''''''''''''''''''''''PortC.6 as Transmit pin	 to pc com1
    
    	   IF B2 = 65 then  
    	       If PortB.1 = 0 then
    	          High PortB.1 
               else
                  Low PortB.1
               Endif 
               else
               	            
    	   ENdif
    goto start
    I noticed that it is generating random numbers pls see the attach...anybody knows what's the reason?

    Thanks in advance
    mbox
    Attached Images Attached Images  
    Last edited by mbox; - 6th October 2009 at 07:34.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    Are you sending somthing from the PC and the random numbers are the echo?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Dec 2005
    Posts
    1,073

    Default

    SerOut to the PC serial port needs to be inverted - use N9600.

  4. #4
    Join Date
    Oct 2008
    Posts
    65

    Default

    Hi everyone,

    mackrackit: Are you sending somthing from the PC and the random numbers are the echo?
    It suppose to lit a LED on PortB.1 when "A" is pressed. Connecting the EGBC TX--> PIC Rx causes the random generation number.

    dhouston: SerOut to the PC serial port needs to be inverted - use N9600.
    I tried that but it gives character sysmbols..pls see the attachment.
    Attached Images Attached Images   

  5. #5
    Join Date
    Dec 2005
    Posts
    1,073

    Default

    Quote Originally Posted by mbox View Post
    I tried that but it gives character sysmbols..pls see the attachment.
    I'm confused. Your code example comment says "PortC.6 as Transmit pin to pc com1" but your latest schematic appears to indicate another wireless connection to the PC.

    A wired RS232 connection needs N9600 for SerOut while a wireless connection may use T9600. A wireless connection may also be noisy, leading to the random data of your first example.

  6. #6
    Join Date
    Oct 2008
    Posts
    65

    Default

    Hi, sorry if it is confusing. I forgot to tell you that I'm using my mobile to send data to the bluetooth module and hopefully have it echoed to the Pc. My code for my phone is tested, it can send letter 'A' from phone to Pc thru bluetooth communication. And hoping it will the same way to pic with a bluetooth module. So this noise is normal? How can I prevent it from generating. I tried to observe while sending from my phone to pic if 65 is recieved, unfortunately it is not.
    Code:
     IF B2 = 65 then  ' waits for "A"
               If PortB.1 = 0 then
    	 High PortB.1 
               else
                  Low PortB.1
               Endif 
    
               else
               	            
    Endif
    Attached Images Attached Images  
    Last edited by mbox; - 7th October 2009 at 08:17.

  7. #7
    Join Date
    Dec 2005
    Posts
    1,073

    Default

    It may just be that your schematic is what confused me. I'm not familiar with Bluetooth serial adapters but would expect them to handle the noise suppression automatically.

    Try this:
    Code:
    start:  SerIn PortB.0,T9600,["A"] 		'wait for "A" on PortB.0
    	If PortB.1 = 0 Then
    	  SerOut PORTC.6,N9600,["HIGH",13,10]
    	  High PortB.1 
            Else
              Serout PORTC.6,N9600,["LOW",13,10]
              Low PortB.1
            Endif             	            
    	GoTo start

Similar Threads

  1. Bluetooth problme with the 16F877A
    By slimpeng in forum Bluetooth
    Replies: 6
    Last Post: - 27th June 2009, 12:06
  2. interaction between Bluetooth and PIC MCU
    By veenadari in forum Bluetooth
    Replies: 1
    Last Post: - 23rd June 2009, 15:03
  3. help my bluetooth and PIC 16F877A?
    By slimpeng in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th March 2008, 06:52
  4. Bluetooth GPS and PBP interfacing
    By RFsolution in forum Bluetooth
    Replies: 0
    Last Post: - 5th January 2006, 11:17
  5. Bluetooth wireless with PIC / HSERIN / DAC
    By rpatel in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2004, 22:13

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts