Bluetooth problme with the 16F877A


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2008
    Posts
    28

    Default Bluetooth problme with the 16F877A

    hello...got thing want to ask u all de.....now i using the KC-21 bluetooth module to connect with the pic 16F877A and now i facing the problem is why my pic tx out the data to my kc-21 bluetooth cant tx to the receiver part and the receiver part i also using the kc21 bluetooth module with max232 and the hyperterminal there cant receiver the data from my tx there...what the happen...below is my programming souce code....hope u all can help me....!!! thanks.......a lot...!!!!

    Define LCD_DREG PORTB
    Define LCD_DBIT 4
    Define LCD_RSREG PORTB
    Define LCD_RSBIT 0
    Define LCD_EREG PORTB
    Define LCD_EBIT 1
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    DEFINE OSC 4 ' We're using a 4 MHz oscillator
    DEFINE ADC_BITS 8 ' Set A/D for 8-bit operation
    DEFINE ADC_CLOCK 1 ' Set A/D clock Fosc/8
    DEFINE ADC_SAMPLEUS 50 ' Set A/D sampling time @ 50 uS
    DEFINE debug_mode 0 ' Debug sending True serial data
    DEFINE debug_reg Portc ' Debug Port = PortC
    DEFINE debug_bit 6 ' Debug.bit = PortC.6
    DEFINE debug_baud 9600 ' Default baud rate = 9600
    define loader_user 1


    include "modedefs.bas"

    pause 2000
    LCDOUT 254,1, " WELCOME MY "
    LCDOUT 254,192,20,"MONITOR SYSTEM"

    samples VAR WORD ' Multiple A/D sample accumulator
    sample VAR BYTE ' Holds number of samples to take
    temp VAR BYTE ' Temperature storage
    samples = 0 ' Clear samples accumulator on power-up


    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 = %00000011 ' Set PORTA.0,1,2,5 = A/D, PortA.5 = +Vref
    PAUSE 500 ' Wait .5 second

    loop:

    FOR sample = 1 TO 20 ' Take 20 samples
    ADCIN 0, temp ' Read channel 0 into temp variable
    samples = samples + temp ' Accumulate 20 samples
    PAUSE 250 ' Wait approximately 1/4 seconds per loop 250
    NEXT sample

    temp = samples/20


    LCDOUT $FE, 1 ' Clear LCD
    LCDOUT "My Temp: ",DEC temp,"'C"
    serout Portc.6,N9600,[#temp]


    pause 5000

    If temp >= 80 then Alarm
    if temp <= 20 then Alarm1
    high portd.0
    samples = 0 ' Clear old sample accumulator
    GOTO loop ' Do it forever
    end

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by slimpeng View Post
    DEFINE debug_mode 0 ' Debug sending True serial data
    DEFINE debug_reg Portc ' Debug Port = PortC
    DEFINE debug_bit 6 ' Debug.bit = PortC.6
    DEFINE debug_baud 9600 ' Default baud rate = 9600
    define loader_user 1
    Let me guess...if you can't get this code to work...something will happen, right? What could that something be
    http://www.picbasic.co.uk/forum/showthread.php?t=7953

    No need to double post!!!
    CAPS! CAPS! CAPS!!! DEFINEs need to be in CAPS just like the book says!
    Not that it has anything to do with your problem...

    Still trying this on a simulator?

    Isn't this project about overdue by now? After all, it is for school, right?

    Read the manual (and other relevant datasheets) concerning your use of N9600 and a MAX232...

    Do you still expect to read a sensor with ADCIN and have it be magically converted from voltage to C?

    Seriously though...if you can't make the project work without the bluetooth module, how do expect it to work WITH the bluetooth module...
    Small steps...tiny tiny tiny small steps...build it up from nothing to the finished product...
    Last edited by skimask; - 14th March 2008 at 14:31.

  3. #3
    Join Date
    Jan 2008
    Posts
    28

    Default

    yup this is my school project...i finish ADC part ad...result also get it...now the problme is why the pic cant communicat with bluetooth module one and i very blur ad...if using RF module can get the result......if using bluetooth cant why...
    if the source code problme or other thing problme....
    help it....pls........

  4. #4
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by slimpeng View Post
    yup this is my school project
    (SIGH...)

    now the problme is why the pic cant communicat with bluetooth module one
    Read the manual (and other relevant datasheets) concerning your use of N9600 and a MAX232...

    help it....pls........
    Or....

  5. #5
    Join Date
    Jan 2008
    Posts
    28

    Default

    i read ad the data sheet .....but still got problme......now i got 2 bluetooth module ...one bluetooth module connet to pc with the MAX232 without any PIC and another one bluetooth with the PIC 16F877A so on the PIC there i send out the temperature data to bluetooth and bluetooth Tx to Rx bluetooth at PC there so....why the Rx part bluetooth cant get my data or communicate with the bluetooth one...???? Is the PIC problem or programming problem ?

    on the PIC 16F877A i set the comment is "SEROUT PORTC.6,N9600,[#temp,13,10]
    and the PC there i using hyperterminal to test it...at there i set the baudrate 115200 the hyperterminal can communicate with my bluetooth. so now only cant communicate with my PIC 16F877A so help it ......????

    if i using the USB bluetooth can ply around with the bluetooth module with the max232 on the PC part......!!! so can u tell me wat the problme with the PIC thanks u all....!!!!

  6. #6
    Join Date
    Jan 2008
    Posts
    28

    Default

    why so selffish one de.......about that is school project one u all no want to help people ad......i very upsad.........at here ad.......!!!! if we knw how to do it...also no come here to asking and asking ad.........

  7. #7
    cherylin's Avatar
    cherylin Guest

    Default

    How do I install my bluetooth to my new phone? I got a new Palm Treo. I want to set up my bluetooth that I have. I already uninstalled it from my old LG Fusic phone. It says it searching for device. But all my new phone finds is my old phone. Its not picking up my bluetooth. I threw away the instructions a long time ago. If it helps my bluetooth is a Motorola. Not sure what model. Like I said I threw everything away. Thanks for your help!

Similar Threads

  1. interaction between Bluetooth and PIC MCU
    By veenadari in forum Bluetooth
    Replies: 1
    Last Post: - 23rd June 2009, 16:03
  2. help my bluetooth and PIC 16F877A?
    By slimpeng in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th March 2008, 07:52
  3. RS232 to blue tooth modules
    By isaac in forum Bluetooth
    Replies: 8
    Last Post: - 14th March 2008, 14:00
  4. Clock connection to DS1802 from 16F877A
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd January 2006, 19:52
  5. Bluetooth wireless with PIC / HSERIN / DAC
    By rpatel in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2004, 23:13

Members who have read this thread : 1

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