usart-bluetooth problem


Closed Thread
Results 1 to 33 of 33

Hybrid View

  1. #1
    Join Date
    Dec 2014
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Re: usart-bluetooth problem

    hi;
    i solved my problem when i checked wiring between pic and bluetooth module. then i succeed to send some data from pic to pc. everything works fine; but when it comes to send sth from pc to module, i fail i think there can be two reason for this.
    one: low voltage level for pic-18f452 (data line-3,3 v)
    two: codes...
    what do you think?

    thanks...
    Code:
    DEFINE OSC 4
    
    
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 0
    DEFINE LCD_EREG PORTD
    DEFINE LCD_EBIT 5
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 6
    DEFINE LCD_RWREG PORTD
    DEFINE LCD_RWBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_Lines 2
    
    
    DEFINE HSER_RCSTA 90h'%10010000  
    DEFINE HSER_TXSTA 24h'%00100100
    DEFINE HSER_CLROERR 1
    DEFINE HSER_BAUD 9600 
    DEFINE HSER_SPBRG 25 
    
    A VAR WORD
    symbol LED=PORTE.1
    
    TRISA.0=1
    TRISC.7=1
    TRISC.6=0
    TRISE.1=0  
    
    LCDOUT $FE,1
    LED=1:
    PAUSE 2000:
    LED=0
    PAUSE 1000
    A=0
    LCDOUT $FE,1,"HELLO"
    pause 2000
    
    MAIN:          
    HSERIN [A]
    LCDOUT $FE,1, "A: ", DEC A
    PAUSE 1000
    GOTO MAIN
    
     
    End

  2. #2
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: usart-bluetooth problem

    I would suggest the following items.
    1. Change your "A" variable to a byte instead of a word since asynchronous serial ports transmit and receive ASCII characters which are bytes not words.
    A var byte

    2. Check the manual on HSERIN and use the timeout and label options with your command to help debug the issue.
    Maybe something like this....

    MAIN:

    HSERIN 100, timesup, [A]
    LCDOUT $FE, 1
    LCDOUT $80, "A: ", Dec A
    PAUSE 1000
    GOTO MAIN

    timesup:

    LCDOUT $FE, 1
    LCDOUT $FE, $80, "Timed Out!"
    PAUSE 2000
    GOTO MAIN

    END


    Regards,

Similar Threads

  1. Bluetooth headset for non bluetooth devices?
    By Normnet in forum Bluetooth
    Replies: 4
    Last Post: - 26th September 2015, 11:22
  2. USART SPI problem !
    By TripleS in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th October 2007, 22:09
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  4. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56
  5. PIC16F688 USART problem
    By Kees Reedijk in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd October 2006, 04:59

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