EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / 8051 Interfacing with bluetooth

8051 Interfacing with bluetooth

|

Microcontroller › 8051 › 8051 Interfacing with bluetooth

  • This topic has 5 replies, 2 voices, and was last updated 10 years, 3 months ago by Ashutosh Bhatt.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • April 2, 2015 at 8:47 am #3598
    Shiv
    Participant

    I am trying to do "ultrasonic range finder" project mentioned here. Instead of using 7 segment displays, i am tryiing to interface bluetooth to serial port of 8051 and i am transfering that data to laptop to process it there. But despite of doing connections in a correct manner there has been no tranmisison of data from 8051 to laptop. I am using real term software on laptop. I have used 9600 baud rate. The bluetooth module i am using is hc-05.

    PS- 1)I have checked code in keil by running it step by step mode in debuggin and program does what is expected .

           2)  I have connected HC-05 in correct manner( tx of bt to rx of 8051,rx of bt to tx of 8051)

           3) hc-05 and software real term are working fine since i have checked them using arduino.

    please help i am posting my source code here:

    ORG 00H
    SETB P3.0//sets p3.0 as input from bluetooth module
    CLR P3.1//sets p3.1 as output to bluetooth module
    CLR P3.2 // sets P3.2 as output for sending trigger
    SETB P3.3 // sets P3.3 as input for receiving echo
    MAIN: MOV TMOD,#00100000B // sets timer1 as mode 2 auto reload timer
          MOV TL1,#210D // loads the initial value to start counting from
          MOV TH1,#210D // loads the reload value
          MOV A,#00000000B // clears accumulator
          SETB P3.2 // starts the trigger pulse
          ACALL DELAY1 // gives 10uS width for the trigger pulse
          CLR P3.2 // ends the trigger pulse
    HERE: JNB P3.3,HERE // loops here until echo is received
    BACK: SETB TR1 // starts the timer1
    HERE1:JNB TF1,HERE1 // loops here until timer overflows (ie;48 count)
          CLR TR1 // stops the timer
          CLR TF1 // clears timer flag 1
          INC A // increments A for every timer1 overflow
          JB P3.3,BACK // jumps to BACK if echo is still available
          MOV R4,A // saves the value of A to R4
          ACALL SEND
          ACALL DELAY
          ACALL DELAY
          ACALL DELAY      
    SJMP MAIN // jumps to MAIN loop
     
    DELAY1: MOV R6,#2D // 10uS delay
    LOOP1: DJNZ R6,LOOP1
    RET     
     
    SEND:  MOV TMOD,#20H// timer 1 in mode 2 autoreload
           MOV TH1,#0FDH//baud rate 9600 generation
      MOV SCON,#50H
           SETB TR1
           MOV A,R4
      MOV SBUF,A//serial tranmisison via tx connected to bluetooth module
    THERE: JNB TI,THERE
           CLR TI
      RET
    DELAY: MOV TMOD,#00010000B
           MOV TH1,#00H
           MOV TL1,#00H
           SETB TR1
    HERE3: JNB TF1,HERE3
           CLR TR1
           CLR TF1
           RET
    END 
    April 3, 2015 at 7:15 pm #12750
    Ashutosh Bhatt
    Participant

    does your bluetooth device pairs with laptop's inbuilt bluetooth? u can also try flash magic software. it has also serial port monitor

    April 4, 2015 at 5:45 pm #12762
    Shiv
    Participant

    yes it pairs with laptop properly, and even sends data correctly i have checked its pairing using arduino and it works correctly. I dont know what wrong happens when i do it with AT89S52(8052) 

    April 6, 2015 at 11:58 am #12769
    Ashutosh Bhatt
    Participant

    i think there is a problem in baud rate setting.

    which crystal u r using? you must use 11.0592 MHz crystal only

    April 6, 2015 at 12:49 pm #12771
    Shiv
    Participant

    Yes that only i am using . Crystal of 11.0592 MHZ along with two 33pf capacitors connected between 18 and 19 pins to ground . Still the problem persists 

     
     
     
     
     

     

      

    April 17, 2015 at 11:15 am #12802
    Ashutosh Bhatt
    Participant

    the micro controller sends HEX data

    while any serial terminal software only displays ASCII characters

    so convert ur HEX data into ASCII and then send them one by one to computer/laptop through bluetooth

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • More fun with ws2812 this time XC8 and CLC July 17, 2025
  • Pic18f25q10 osccon1 settings swordfish basic July 16, 2025
  • Pickit 5 July 16, 2025
  • turbo jet fan - feedback appreciated. July 16, 2025
  • I Wanna build a robot July 16, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise