This blog post summarize how to interface Bluetooth with 8051 using assembly programming
PS-TRAINER-8051 trainer kit is proposed to smooth the progress of learning and developing designs of MCU from Intel and NXP. It has the facility to connect PC’s 101/104 Keyboard, to enter user programs in Assembly languages. Serial communication achieved using 8051. It also supports C & assembly language in standalone kit (P89V51RD2). It’s designed as to facilitate On-board Programmer for NXP 8051 MCU through ISP on serial port.
Bluetooth
Bluetooth is a proprietary open wireless technology standard for exchanging data over short distances from fixed and mobile devices, creating personal area networks (PANs) with high levels of security. Bluetooth technology allows electronic devices to communicate wirelessly.
Interfacing Bluetooth with 8051
Fig. 1 shows how to interface the Bluetooth with microcontroller. Bluetooth technology handles the wireless part of the communication channel; it transmits and receives data wirelessly between these devices. It delivers the received data and receives the data to be transmitted to and from a host system through a host controller interface (HCI). The most popular host controller interface today is either a UART or a USB. Here, I will only focus on the UART interface; it can be easily show how a Bluetooth module can be integrated on to a host system through a UART connection.
Interface Bluetooth with 8051
We now want to transmit & receive the data from host system to PS-2 8051 Trainer by using Bluetooth module through UART0. The serial data is taken from or sent to the host system by using Bluetooth module through MAX232 into the SBUF register of 8051 microcontroller (refer serial interfacing with 89V51RD2). The serial data from the host device is taken by using the Serial Interrupt of the 8051 controller. The UART0 pin lines are used to transmit & receive operations in PS-2 8051 Trainer
Pin assignment with 8051
Circuit diagram to Interface Bluetooth with 8051
Assembly program to interface Bluetooth with 8051
MEMORY ADDRESS | OPCODE | MNEMONICS |
8500 | 75,89,21 | MOV TMOD,#21 |
8503 | 75 8D FD | MOV TH1,#FD |
8506 | 75 98 52 | MOV SCON,#52 |
8509 | D2 8E | SETB TR1 |
850B | 74 41 | H:MOV A,#41 |
850D | B1 11 | ACALL TXMT |
850F | 80 FA | SJMP H |
8511 | 30 99 FD | TXMT:JNB TI,TXMT |
8514 | C2 99 | CLR TI |
8516 | F5 99 | MOV SBUF,A |
8518 | 22 | RET |