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

ELE492 Embedded System Design

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

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing

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.

Embedded Systems Programming and Architectures

Experiment 7:The USART

IE1206 Embedded Electronics

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

FULL DUPLEX BIDIRECTIONAL UART COMMUNICATION BETWEEN PIC MICROCONTROLLERS

Example of Asyncronous Serial Comms on a PIC16F877

Serial Communications

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

USB UART 4 click PID: MIKROE Weight: 23 g

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

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

DIPLOMA THESIS DETECTION AND PREVENTION OF FAULTY PINS

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

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

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

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

Serial Communications


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

Asynchronous Transmission. Asynchronous Serial Communications & UARTS

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

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

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

19.1. Unit 19. Serial Communications

Embedded Systems and Software. Serial Communication

Embedded Systems and Software

Innovati s Bluetooth 100M Universal Wireless Bluetooth Module

CoE3DJ4 Digital Systems Design. Chapter 5: Serial Port Operation

Basics of UART Communication


ES- JBM-141SPP Module. Application Note

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

Hierarchy of I/O Control Devices

Source Codes for DRA818U/DRA818V

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

Microcontroller basics

COMP2121: Microprocessors and Interfacing

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

Interfacing a Hyper Terminal to the Flight 86 Kit

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

TKT-3500 Microcontroller systems

Amarjeet Singh. January 30, 2012

UART: Universal Asynchronous Receiver & Transmitter

Laboratory 5 Communication Interfaces

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

SA818 Programming Manual

PIC-I/O Multifunction I/O Controller

Laboratory Finite State Machines and Serial Communication

USB232 board. EB039

8051 Timers and Serial Port

Universal Asynchronous Receiver / Transmitter (UART)

GSM Library. Version 3.1. User Manual.

The University of Texas at Arlington Lecture 21_Review

Display Real Time Clock (RTC) On LCD. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

8051 Serial Communication

RFID: Read and Display V2010. Version 1.1. Sept Cytron Technologies Sdn. Bhd.

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

USB232 board EB Technical datasheet

The MICROPROCESSOR PRINCIPLES AND APPLICATIONS Lab 7

How to use RFpro in Packet Mode

EE 354 November 13, 2017 ARM UART Notes

PIL-IO board notes. For use with firmware 2.x. J-F Garnier, Feb. 2016

Introduction USART & AVR EVK1100

User s Manual Closer to Real, Zigbee Module ZIG-100. Wireless Communication. ROBOTIS CO.,LTD

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

Interrupts and Serial Communication on the PIC18F8520

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

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

Engineer-to-Engineer Note

Altera EP4CE6 Mini Board. Hardware User's Guide

SNR610. Embedded network node module SNR610. Description. Feature. Application. SNR610 is highly integrated network module.

Universal Asynchronous Receiver Transmitter Communication

Unit 19 - Serial Communications 19.1

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

[WIR-1286]868MHz LORA Wireless Module. Page 1. LORA 868MHz Wireless serial link [WIR-1286]

ECE251: Thursday November 8

DF BluetoothV3 Bluetooth module (SKU:TEL0026)

Kit Contents. Getting Started Kits. Board. Board

Application Note One Wire Digital Output. 1 Introduction. 2 Electrical Parameters for One Wire Interface. 3 Start and Data Transmission

Fig.12.5 Serial Data Line during Serial Communication

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

MODEL DSU Kbps Rack Mount CSU/DSU OPERATOR S MANUAL. 280 I-80 West Exit 1 PO Box 1330 Verdi NV 89439

Serial communication

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

ĐẠI HỌC QUỐC GIA TP.HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA ĐIỆN-ĐIỆN TỬ BỘ MÔN KỸ THUẬT ĐIỆN TỬ. Embedded System Design

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad

CN310 Microprocessor Systems Design

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

or between microcontrollers)

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

ATmega128 USART. Overview

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 Specific Function 8-bit Registers for PIC16F877A USART module: 1. TXSTA 2. RCSTA 3. SPBRG 4. TXREG 5. RCREG 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 Baud Rate Generator Register TXREG USART Transmit Register RCREG USART Receive 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: Bit 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_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: Bit 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: 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 / B LEDs blink 3 consecutive times all together with 1 second delay -Received data = Shift / S LEDs get turned ON one after the other - Received data = ON / O LEDs are turned ON - Any other received data LEDs are turned OFF

Bluetooth Module Connection

Easy Bluetooth Connection Eng. Ahmed Atteya

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/character Via the UART module. Start by initializing the Baud Rate and wait for 100ms to initialize 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. Burn the MikroC program on your PIC and plug it in the circuit 3. Power up your Bluetooth module. 4. Pair your Bluetooth module with your PC/ Mobile-phone. 5. Open the X-CTU/Bluetooth terminal on PC/Mobile-phone. 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

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/MobilePhone based on the MikroC code

Components for Next Lab Remote Control Car Resistances 330 Ohm 2 Mini USB cables 10 switches/push buttons 1 (+1 extra) Voltage regulator 3.3V (LD1117V33) 1 battery 9V H-Bridge (L298) Ultrasonic Sensor