ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC

Similar documents
ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC

Serial Communication with PIC16F877A

Serial Communication

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing

ELE492 Embedded System Design

Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar

Section 21. Addressable USART

ELCT 912: Advanced Embedded Systems

Parallel IO. Serial IO. Parallel vs. Serial IO. simplex vs half-duplex vs full-duplex. Wires: Full Duplex. Wires: Simplex, Half-duplex.

Experiment 7:The USART

EXPERIMENT 7: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

Embedded Systems Programming and Architectures

FULL DUPLEX BIDIRECTIONAL UART COMMUNICATION BETWEEN PIC MICROCONTROLLERS

Example of Asyncronous Serial Comms on a PIC16F877

IE1206 Embedded Electronics

Serial Communications

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Hello, and welcome to this presentation of the STM32 Low Power Universal Asynchronous Receiver/Transmitter interface. It covers the main features of

USB UART 4 click PID: MIKROE Weight: 23 g

Asynchronous Transmission. Asynchronous Serial Communications & UARTS

MCS-51 Serial Port A T 8 9 C 5 2 1

APPLICATION NOTE 2361 Interfacing an SPI-Interface RTC with a PIC Microcontroller

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features


DIPLOMA THESIS DETECTION AND PREVENTION OF FAULTY PINS

Innovati s Bluetooth 100M Universal Wireless Bluetooth Module

CoE3DJ4 Digital Systems Design. Chapter 5: Serial Port Operation

ECE 354 Introduction to Lab 1. February 5 th, 2003

Serial Communications

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller

Serial Communication Prof. James L. Frankel Harvard University. Version of 2:30 PM 6-Oct-2015 Copyright 2015 James L. Frankel. All rights reserved.

To be familiar with the USART (RS-232) protocol. To be familiar with one type of internal storage system in PIC (EEPROM).

Design, Development & Implementation of a Temperature Sensor using Zigbee Concepts


19.1. Unit 19. Serial Communications

Embedded Systems and Software. Serial Communication

UART: Universal Asynchronous Receiver & Transmitter

Embedded Systems and Software

Goal: activate the USART module USART1 on target chip and provide basic functions.

Basics of UART Communication

COMP2121: Microprocessors and Interfacing

Addressing scheme to address a specific devices on a multi device bus Enable unaddressed devices to automatically ignore all frames

Maxim > Design Support > Technical Documents > Application Notes > Microcontrollers > APP 4465

8051 Serial Communication

Interfacing a Hyper Terminal to the Flight 86 Kit

How to use RFpro in Packet Mode

EE 354 November 13, 2017 ARM UART Notes

Source Codes for DRA818U/DRA818V

TKT-3500 Microcontroller systems

PIC-I/O Multifunction I/O Controller

8051 Timers and Serial Port

Universal Asynchronous Receiver / Transmitter (UART)

GSM Library. Version 3.1. User Manual.

Microcontroller basics

Demo 17 - Receiving data from Host through Serial Port. Introduction:

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Serial Port Communication Module No: CS/ES/11 Quadrant 1 e-text

In the HEW, open a new project by selecting New workspace from the main menu.

Hierarchy of I/O Control Devices

SA818 Programming Manual

Introduction USART & AVR EVK1100

The MICROPROCESSOR PRINCIPLES AND APPLICATIONS Lab 7

Lab 6 RS-232 Communication The following routines are provided for devices with a single USART peripheral:

Section 21. UART UART HIGHLIGHTS. This section of the manual contains the following major topics:

Engineer-to-Engineer Note

The University of Texas at Arlington Lecture 21_Review

Universal Asynchronous Receiver Transmitter Communication

USART. USART stands for Universal Synchronous Asynchronous Receiver Transmitter. Full-duplex NRZ asynchronous serial data transmission

DF BluetoothV3 Bluetooth module (SKU:TEL0026)

ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers. Eng. Salma Hesham

8051 Serial Port. EE4380 Fall02 Class 10. Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

Section 21. UART UART HIGHLIGHTS. This section of the manual contains the following topics:

USB232 board EB Technical datasheet

Lecture 10. Serial Communication

Parameters. Specifications. Bluetooth Specification V4.0 BLE. Modulation method GFSK(Gaussian Frequency Shift Keying)

Fig.12.5 Serial Data Line during Serial Communication

AN-1435 APPLICATION NOTE

Using UART in radio data transmission with the CDP-02 module By Tomihiko Uchikawa

Interrupts and Serial Communication on the PIC18F8520

ATmega128 USART. Overview

Device: MOD This document Version: 1.0. Matches module version: v3 [29 June 2016] Date: 23 October 2017

Kit Contents. Getting Started Kits. Board. Board

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE Microcontroller Based System Design

Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table

Laboratory 5 Communication Interfaces

Up to three (3) RIO-RS232 modules may be attached to one RIO-PBA Profibus adapter.

Serial communication

C1098 JPEG Module User Manual

CprE 288 Introduction to Embedded Systems (UART Interface Overview)

USB232 board. EB039

USART Register Description

Grove - BLE. Release date: 9/20/2015. Version: 1.0. Wiki:

Xbee module configuration from a µcontroller

EECS 373 Design of Microprocessor-Based Systems

Sender Receiver Sender

SPART. SPART Design. A Special Purpose Asynchronous Receiver/Transmitter. The objectives of this miniproject are to:

Embedded Modbus TCP Module GS11-MT. User Manual REV 1.1. SST Automation.

A B C D E F 0480 FE B F5 3B FC F3 E 1A 1D 2A 2D 3A 3D 4A 4D 5A 5D 6A 6D 7A 7D

Amarjeet Singh. January 30, 2012

Introduction to Ethernet. Guy Hutchison 8/30/2006

EXPERIMENT 8: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

Transcription:

ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC

USART in PIC16F877A Universal Synchronous/Asynchronous Receiver Transmitter - Can receive and transmit - Can be synchronous or Asynchronous Synchronous: - Uses a clock and one data signal Asynchronous: - One pin for transmission and another for reception - Full duplex asynchronous operation (both transmission and reception can occur at the same time)

USART in PIC16F877A Universal Synchronous/Asynchronous Receiver Transmitter - Can receive and transmit - Can be synchronous or Asynchronous Synchronous: - Uses a clock and one data signal Most commonly used Asynchronous: - One pin for transmission and another for reception - Full duplex asynchronous operation (both transmission and reception can occur at the same time)

UART in PIC16F877A PIC16F877A has 4 Specific Function 8-bit Registers for USART module: 1. TXSTA 2. RCSTA 3. SPBRG 4. TXREG Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 TXSTA CSRC TX9 TXEN SYNC - BRGH TRMT TX9D RCSTA SPEN RX9 SREN CREN - FERR OERR RX9D SPBRG TXREG Baud Rate Generator Register USART Transmitter Register

UART Library in MikroC-Pro Provides comfortable work with the Asynchronous mode Built-in UART functions which set the proper bits for the specific UART PIC registers at each required command Library Functions: UART1_Init UART1_Data_Ready UART1_Tx_Idle UART1_Read UART1_Read_Text UART1_Write UART1_Write_Text UART_Set_Active

UART Library in MikroC-Pro Library Functions: void UART1_Init(unsigned long baud_rate); - It Initializes the desired UART module with the given baud rate. For PIC16F877A with 4MHz oscillator, use baud rate = 9600. -It returns nothing - Example: UART1_Init(2400);

UART Library in MikroC-Pro Library Functions: char UART1_Data_Ready(); - It tests if there is a ready data in receive register for reading. The baud rate of the UART module must be initialized before using this function - It returns: 1 if data is ready for reading 0 if there is no data in the receive register - Example: if(uart1_data_ready()){ // do what ever }

UART Library in MikroC-Pro Library Functions: char UART1_Tx_Idle(); - It tests if the transmit shift register is empty or not. The baud rate of the UART module must be initialized before using this function - It returns: 1 if data is ready for reading 0 if there is no data in the receive register - Example: if(uart1_tx_idle()){ // do what ever }

UART Library in MikroC-Pro Library Functions: char UART1_Read(); - It receives one byte through the UART when data is ready in the received register. The baud rate of the UART module must be initialized before using this function - It returns the received byte. - Example: x = UART1_Read(); // x is a char

UART Library in MikroC-Pro Library Functions: void UART1_Read_Text(char *Output, char * Delimiter, char Attempts); - It reads characters via UART until the delimiter sequence is detected. The parameters of this function are: output: contains the received text of successive characters delimiter: sequence of characters which defines the end of the received string. Attempts: defines the number of characters in which the delimiter is expected to be found, otherwise, the procedure will exit anyway. -Example: UART1_Read_Text(output, OK,10); //output is defined previously as char *output;

UART Library in MikroC-Pro Library Functions: void UART1_write(char x); - It transmits one byte through the UART module. The parameter x is the byte to be sent. The baud rate of the UART module must be initialized before using this function. - It returns nothing. - Example: char x = 0xFF; UART1_Write(x);

UART Library in MikroC-Pro Library Functions: void UART1_Write_Text(char *text); - It sends text via UART. The parameter text is the text to be sent. The Baud rate of the UART module should be initialized before using this function. - Example: UART1_Write( Start );

Control LEDs from PC/ mobile-phone using the UART module Task 1 Write the MikroC code to use the UART module to control 8 LEDs on Port B through PC/mobilephone Bluetooth such that if: -received data = Blink LEDs blink 3 times together with 1 second delay -Received data = Shift LEDs get turned ON one after the other - Received data = ON LEDs are turned ON - Any other received data LEDs are turned OFF

Easy Bluetooth Connection

Guiding Steps for Using UART Module with Bluetooth Connection 1. Write the MikroC code to control the LEDs on Port B according to the received string Via the UART module. Start by initializing the Baud Rate and wait for 100ms to intialize Send a test text from Bluetooth to PC/Mobile-phone, followed by new line (0x0A) and a carriage return (0x0D) to reset the cursor position to the start of a new line. Start your while(1) where you check if data ready, then read it and control the PORTB LEDs based on the received text. 2. Power up your Bluetooth module. 3. Pair your Bluetooth module with your PC/ Mobile-phone. 4. Open the X-CTU/Bluetooth terminal on PC/Mobile-phone. 5. Burn the MikroC program on your PIC and plug it in the circuit. 6. Send and receive through the terminal and the LEDs should be controlled through the received strings.

Guiding Steps for Using UART Module with Bluetooth Connection

Guiding Steps for Using UART Module with Bluetooth Connection Test text sent from Bluetooth module to PC based on the MikroC code