RS232.C An Interrupt driven Asyncronous Serial Port
|
|
- Eustacia Phyllis Burns
- 6 years ago
- Views:
Transcription
1 /***************************************************************************/ /* RS232.C An Interrupt driven Asyncronous Serial Port */ /* Date : 06/03/2002 */ /* Purpose : Asyncronous Transmitter & Receiver */ /* Mode : 9600 Baud, 1 stopbit, No parity */ /***************************************************************************/ /************************/ /* Function prototypes */ /************************/ void Setup(void); void TxNextBit(void); void PutChar(char); char GetChar(void); void StartBitDetect(void); void RcvNextBit(void); /* Global Register assignments */ char TxByte; char RxByte; char TxRxBitCount; char SerialStatus; char data; // The Byte to Transmit // The Received Byte // Bit counter for TX/RX // Serial status register // General purpose register /* Flag assignments */ /* Bits of SerialStatus */ #define TxOver 0 // Set when byte transmitted #define TxEnable 1 // Set to enable transmitter #define RxOver 2 // Set when byte received #define RxFrameError 3 // Set when stop bit not zero #define RxStarted 4 // Set when receive character is in progress #define RxBit 5 // Unused. /* Bit Mask definitons */ #define RxInputMask 0x10; // Receiver input pin is connected to RA4, // ie. bit 4 of Port A #define TxOverMask 0x01; #define TxEnableMask 0x02; #define RxOverMask 0x04; #define RxFrameErrorMask 0x08; #define RxStartedMask 0x10; #define RxBitMask 0x20; #define IntconRtcc 0x04; 1
2 /******************************/ /* TxRxBitCount event numbers */ /* ( Transmit mode ) */ /******************************/ #define StartBit 10 #define Bit0 9 #define Bit1 8 #define Bit2 7 #define Bit3 6 #define Bit4 5 #define Bit5 4 #define Bit6 3 #define Bit7 2 #define StopBit 1 /* Port and system assignments */ #define Rs232Out 1 // Rs232 output port bit //#define Baud9600Rate 207 // TMR0 Rate for 4 Mhz clock //#define Baud9600RatePlusHalf 159 // Start bit to first data bit delay (4Mhz) // // *** May need adjustment *** // Very critical for High Baud Rates - // - at low clock speed #define Baud9600Rate 154 #define Baud9600RatePlusHalf 130 #define Rs232BitMask 1 // TMR0 Rate for 8 Mhz clock // Start bit to first data bit delay (8Mhz) // Mask for RS232 send TxNextBit() #define PortAConfig 0x14 // Configure port A ( 1 = input ) // RA4/RTCC = Input / RA2 = Input #define PortBConfig 0xff // Configure port B ( All Input ) #define TxMode 0x40 // Set option reg TMR0 interrupt source from counter. // Max speed prescaler ( 1:2 ) #define RxMode TxMode #define RxStartbitMode 0x78 // TMR0 source is External Clock (falling edge), // Assign prescaler to Watchdog timer // - for detection of START BIT #define POSLOGIC 1 Transmitter ) // When defined then USE TRUE RS232 LEVELS ( For 2
3 /***************************************************************/ /* Start of MAIN */ /***************************************************************/ main() const char Message[] = 'H', 'e', 'l', 'l', 'o', '!', 13, 10, 0x00 ; char a; Setup(); // Set-up the system. set_bit( SerialStatus, TxEnable ); // *** Enable Transmitter *** a = 0; while ( Message[a]!= 0x00 ) PutChar( Message[a++] ); // Send the Message while ( ( SerialStatus & TxOverMask ) == 0 ); while(1) data = GetChar(); // Receive the next Character if ( ( SerialStatus & RxFrameErrorMask ) == 0 ) // Is it a valid character? PutChar(data); // Echo the Received byte transmitted while ( ( SerialStatus & TxOverMask ) == 0 ); // Wait for Character to be // End of Main 3
4 /************************************************************/ /* Process any interrupts */ /************************************************************/ void interrupt( void ) if ( ( INTCON & IntconRtcc )!= 0 ) // If the RTCC times-out // If the transmitter is enabled // - then begin to transmit if ( ( SerialStatus & TxEnableMask )!= 0 ) TxNextBit(); // Send next bit. // If no character is being received else if ( ( SerialStatus & RxStartedMask ) == 0 ) StartBitDetect(); // Initialise Receiver ( wait for a start bit ) else RcvNextBit(); // Else receive the next bit // Return from Interrupt // End of Interrupt Service routine /*******************************/ /* Setup Ports and Interrupts */ /*******************************/ void Setup(void) set_bit( STATUS, RP0 ); OPTION_REG = TxMode; set_tris_a( PortAConfig); set_tris_b( PortBConfig ); // Set Option register to transmitter mode // Setup ports // Set the RS232 output to "Stop bit" output_low_port_a( Rs232Out ); output_high_port_a( Rs232Out ); TxRxBitCount = StartBit; // Setup bit count SerialStatus = 0; // Clear other flags set_bit( SerialStatus, TxOver ); // Set the TxOver status for 'Ready' disable_interrupt( T0IE ); // Disable TMR0 overflow bit enable_interrupt( GIE ); // Enable Global Interrupts 4
5 /********************/ /* Send a character */ /********************/ void PutChar(char ch) // Wait for stop bit of while ( ( SerialStatus & TxOverMask ) == 0 ); // last character to be transmitted clear_bit( SerialStatus, TxOver ); // Reset TxOver flag TxByte = ch; // Setup the data byte to send TMR0 = Baud9600Rate; to - // - initiate transmission # while ( TxRxBitCount!= Bit0 ); // Wait for start bit done. /*******************************************/ /* Send next bit Interrupt service routine */ /*******************************************/ void TxNextBit(void) if ( TxRxBitCount == StartBit ) // Send the start bit output_high_port_a( Rs232Out ); // True RS232 output_low_port_a( Rs232Out ); // Inverted RS232 if ( ( TxRxBitCount <= 9 ) && ( TxRxBitCount >= 2 ) ) // Send the data bits if ( ( TxByte & Rs232BitMask ) == 0 ) // Test bit 0 of data to be sent output_high_port_a( Rs232Out ); // True RS232 output_low_port_a( Rs232Out ); // Inverted RS232 else output_low_port_a( Rs232Out ); // True RS232 output_high_port_a( Rs232Out ); // Inverted RS232 TxByte = ( TxByte >> 1 ); if ( TxRxBitCount == StopBit ) output_low_port_a( Rs232Out ); output_high_port_a( Rs232Out ); // Get next bit to send... // Send the stop bit // True RS232 // Inverted RS232 5
6 TxRxBitCount--; if ( TxRxBitCount == 0 ) TxRxBitCount = StartBit; set_bit( SerialStatus, TxOver ); disable_interrupt( T0IE ); return; // count down the bit counter // Disable TMR0 overflow bit // Return with Interrupt disabled TMR0 = TMR0 + Baud9600Rate; //clear TMR0 overflow flag //enable TMR0 overflow bit // end of TxNextBit(void) /****************************/ /* Start of Receiver code */ /****************************/ /************************************************/ /* Prepare receiver for next character */ /************************************************/ char GetChar(void) SerialStatus = 0; TxRxBitCount = 9; RxByte = 0; set_bit( STATUS, RP0 ); OPTION_REG = RxStartbitMode; TMR0 = 0xff; // Clear Status flags // 8 data bits + 1 stop bit // Clear Rxbyte // Set Option register to receiver mode // Wait for start bit. while( ( SerialStatus & RxOverMask ) == 0 ); // Wait for character ready set_bit( SerialStatus, TxEnable ); set_bit( SerialStatus, TxOver ); TxRxBitCount = StartBit; disable_interrupt( T0IE ); return RxByte; // Enable Transmitter- // -ready for next tx byte // Disable TMR0 overflow bit // Return with the received character // End GetChar() /* Detect the initial start bit of each character */ void StartBitDetect(void) // If RxInput is 0 if ( ( input_port_a() & RxInputMask ) == 0 ) // Start bit detected set_bit( SerialStatus, RxStarted); // Set Rx started flag set_bit( STATUS, RP0 ); // Set Option register to - OPTION_REG = RxMode; // - wait for first data bit TMR0 = Baud9600RatePlusHalf; // Set the timer to wait 1.5 x bit time 6
7 else // False Start bit detected. FalseStartBit: TMR0 = 0xff; set_bit( STATUS, RP0 ); OPTION_REG = RxStartbitMode; clear_bit( SerialStatus, RxStarted ); // Set Option register to receiver mode // end of StartBitDetect() /* Receive the next bit of the current character */ void RcvNextBit(void) if ( TxRxBitCount == 1 ) // Is this the stop bit? if ( ( input_port_a() & RxInputMask ) == 0 ) // Framing error! Stop bit was not '1' set_bit( SerialStatus, RxFrameError ); clear_bit( SerialStatus, RxStarted );// Stop further RTCC interrupts. set_bit( SerialStatus, RxOver ); // Signal GetChar() that byte available disable_interrupt( T0IE ); // Disable TMR0 overflow bit // Receive done else asm rrf _RxByte, F; // if ( ( TxRxBitCount <= 9 ) && ( TxRxBitCount >= 2 ) ) if ( ( input_port_a() & RxInputMask )!= 0 ) set_bit( RxByte, 7 ); else clear_bit( RxByte, 7 ); // Shift RxByte right, for next bit TMR0 = TMR0 + Baud9600Rate; TxRxBitCount--; // Count down bits received. // End of RcvNextBit /* EOF */ 7
Example of Asyncronous Serial Comms on a PIC16F877
/***************************************************************************************/ /* Example of Asyncronous Serial Comms on a PIC16F877 */ /* Target: PIC16F877 */ /* Baud: 9600 */ /* Bits: 8 */
More information8-bit RISC Microcontroller. Application Note. AVR 305: Half Duplex Compact Software UART
AVR 305: Half Duplex Compact Software UART Features 32 Words of Code, Only Handles Baud Rates of up to 38.4 kbps with a 1 MHz XTAL Runs on Any AVR Device Only Two Port Pins Required Does Not Use Any Timer
More informationCENG-336 Introduction to Embedded Systems Development. Timers
CENG-336 Introduction to Embedded Systems Development Timers Definitions A counter counts (possibly asynchronous) input pulses from an external signal A timer counts pulses of a fixed, known frequency
More informationFreescale Semiconductor, I
Application Note 1/2004 Software SCI for the MC68HC908QT/QY MCU By: Pavel Lajsner Freescale Czech System Labs Roznov p.r., Czech Republic General Description Motorola s PC master system provides a method
More informationwhich means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.
Introduction to microprocessors Feisal Mohammed 3rd January 2001 Additional features 1 Input/Output Ports One of the features that differentiates a microcontroller from a microprocessor is the presence
More informationSection 11. Timer0. Timer0 HIGHLIGHTS. This section of the manual contains the following major topics:
M 11 Section 11. HIGHLIGHTS This section of the manual contains the following major topics: 11.1 Introduction...11-2 11.2 Control Register...11-3 11.3 Operation...11-4 11.4 TMR0 Interrupt...11-5 11.5 Using
More informationIE1206 Embedded Electronics
IE1206 Embedded Electronics Le1 Le3 Le4 Le2 Ex1 Ex2 PIC-block Documentation, Seriecom Pulse sensors I, U, R, P, serial and parallell KC1 LAB1 Pulsesensors, Menuprogram Start of programing task Kirchoffs
More informationC:\CYGNAL\Examples\C8051F02x\C\Edu_Board_Source_Code\Magcard.c
Magcard.c Author: Baylor Electromechanical Systems Operates on an external 18.432 MHz oscillator. Target: Cygnal Educational Development Board / C8051F020 Tool chain: KEIL C51 6.03 / KEIL EVAL C51 This
More informationGoal: activate the USART module USART1 on target chip and provide basic functions.
1 z 5 2.4.2013 11:59 dspic33: HW UART Target device: dspic33fj128mc804 Development platform: C30 + MPLAB X Goal: activate the USART module USART1 on target chip and provide basic functions. Associated
More informationEmbedded Systems Design (630470) Lecture 4. Memory Organization. Prof. Kasim M. Al-Aubidy Computer Eng. Dept.
Embedded Systems Design (630470) Lecture 4 Memory Organization Prof. Kasim M. Al-Aubidy Computer Eng. Dept. Memory Organization: PIC16F84 has two separate memory blocks, for data and for program. EEPROM
More informationHello, and welcome to this presentation of the STM32 Low Power Universal Asynchronous Receiver/Transmitter interface. It covers the main features of
Hello, and welcome to this presentation of the STM32 Low Power Universal Asynchronous Receiver/Transmitter interface. It covers the main features of this interface, which is widely used for serial communications.
More informationPIC Discussion By Eng. Tamar Jomaa
PIC Discussion By Eng. Tamar Jomaa 1 Write assembly language instructions to clear the general purpose registers of PIC16F84A microcontroller (don t write the whole program) 2 Islamic university Electrical
More informationEE6008-Microcontroller Based System Design Department Of EEE/ DCE
UNIT- II INTERRUPTS AND TIMERS PART A 1. What are the interrupts available in PIC? (Jan 14) Interrupt Source Enabled by Completion Status External interrupt from INT INTE = 1 INTF = 1 TMR0 interrupt T0IE
More informationHello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features
Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features of this USART interface, which is widely used for serial
More informationChapter 6 PROGRAMMING THE TIMERS
Chapter 6 PROGRAMMING THE TIMERS Lesson 3 Real Time Clocked Interrupts and Software Timers 2 Real Time Clock Interrupt 3 Real Time interrupts Prescaling Pre-scaling by RT1-RT0 bits for 4 or 8 or 16 2 13
More informationThe modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca.
LCD Modules A common output display device used with low cost embedded systems is a character LCD display. The displays are available as complete modules with a standard microprocessor parallel interface.
More informationInterrupts. Embedded Systems Interfacing. 08 September 2011
08 September 2011 An iterrupt is an internal or external event that forces a hardware call to a specified function called an interrupt service routine Interrupt enable must be set (initialization) The
More informationEngineer-to-Engineer Note
Engineer-to-Engineer Note EE-391 Technical notes on using Analog Devices products and development tools Visit our Web resources http://www.analog.com/ee-notes and http://www.analog.com/processors or e-mail
More informationMCS-51 Serial Port A T 8 9 C 5 2 1
MCS-51 Serial Port AT89C52 1 Introduction to Serial Communications Serial vs. Parallel transfer of data Simplex, Duplex and half-duplex modes Synchronous, Asynchronous UART Universal Asynchronous Receiver/Transmitter.
More informationELCT 912: Advanced Embedded Systems
ELCT 912: Advanced Embedded Systems Lecture 10: Applications for Programming PIC18 in C Dr. Mohamed Abd El Ghany, Department of Electronics and Electrical Engineering Programming the PIC18 to transfer
More informationTypical modules include interfaces to ARINC-429, ARINC-561, ARINC-629 and RS-422. Each module supports up to 8 Rx or 8Tx channels.
Modular PCI Range of Cards Summary features Modular Architecture Interface compatible with PCI Local bus Specification, revision 2.1, June 1995 2 or 4 Module General Purpose Carrier Cards 8 Channels per
More informationSection 21. Addressable USART
21 Section 21. Addressable USART Addressable USART HIGHLIGHTS This section of the manual contains the following major topics: 21.1 Introduction... 21-2 21.2 Control Registers... 21-3 21.3 USART Baud Rate
More informationCOMP2121: Microprocessors and Interfacing
COMP2121: Microprocessors and Interfacing Lecture 25: Serial Input/Output (II) Overview USART (Universal Synchronous and Asynchronous serial Receiver and Transmitter) in AVR http://www.cse.unsw.edu.au/~cs2121
More informationEmbedded systems. Exercise session 3. Microcontroller Programming Lab Preparation
Embedded systems Exercise session 3 Microcontroller Programming Lab Preparation Communications Contact Mail : michael.fonder@ulg.ac.be Office : 1.82a, Montefiore Website for the exercise sessions and the
More informationWhen JP1 is cut, baud rate is Otherwise, baud rate is Factory default is that JP1 is shorted. (JP1 is jumper type in some model)
ELCD SERIES INTRODUCTION ALCD is Serial LCD module which is controlled through Serial communication. Most of existing LCD adopts Parallel communication which needs lots of control lines and complicated
More informationInterrupts on PIC18F252 Part 2
Interrupts on PIC18F252 Part 2 Following pages list Special Function Registers (SFRs) involved in interrupt configuration and operation on PIC18F252 microcontroller. (Copied from Microchip s PIC18Fxx2
More informationCPUs. Input and output. Supervisor mode, exceptions, traps. Co-processors. Computers as Components 4e 2016 Marilyn Wolf
CPUs Input and output. Supervisor mode, exceptions, traps. Co-processors. I/O devices Usually includes some non-digital component. Typical digital interface to CPU: CPU status reg data reg mechanism Application:
More informationLearn how to communicate
USART 1 Learn how to communicate Programmed I/O (Software Polling) Interrupt Driven I/O Direct Memory Access (DMA) 2 Programmed I/O (Polling) Processor must read and check I/O ready bits for proper value
More informationXC Input and Output. 1 Outputting Data
XC Input and Output IN THIS DOCUMENT Outputting Data Inputting Data Waiting for a Condition on an Input Pin Controlling I/O Data Rates with Timers Case Study: UART (Part 1) Responding to Multiple Inputs
More informationSoftware Serial Port Implemented with the PCA
APPLICATION BRIEF Software Serial Port Implemented with the PCA BETSY JONES ECO APPLICATIONS ENGINEER August 1988 Order Number 270531-002 Information in this document is provided in connection with Intel
More informationWeek1. EEE305 Microcontroller Key Points
Week1 Harvard Architecture Fig. 3.2 Separate Program store and Data (File) stores with separate Data and Address buses. Program store Has a 14-bit Data bus and 13-bit Address bus. Thus up to 2 13 (8K)
More informationUniversal Asynchronous Receiver / Transmitter (UART)
Universal Asynchronous Receiver / Transmitter (UART) MSP432 UART 2 tj MSP432 UART ARM (AMBA Compliant) Asynchronous operation 7/8 bit transmission Master/Slave LSB/MSB first Separate RX/TX registers 4
More informationUsing FlexIO to emulate communications and timing peripherals
NXP Semiconductors Document Number: AN12174 Application Note Rev. 0, 06/2018 Using FlexIO to emulate communications and timing peripherals 1. Introduction The FlexIO is a new on-chip peripheral available
More informationSection 16. Basic Sychronous Serial Port (BSSP)
M 16 Section 16. Basic Sychronous Serial Port (BSSP) BSSP HIGHLIGHTS This section of the manual contains the following major topics: 16.1 Introduction...16-2 16.2 Control Registers...16-3 16.3 SPI Mode...16-6
More informationFeatures 2.4 GHz Carrier Frequency RS232 UART interface with variable baud rate Input supply voltage: 5V to 12V 255 possible Channels frequencies (0 to 255) Programmable Device Address (255 per channel)
More informationAN Full-duplex software UART for LPC2000. Document information
Full-duplex software UART for LPC2000 Rev. 01 17 January 2008 Application note Document information Info Keywords Abstract Content LPC2000, UART, software This application note illustrates how a simple
More informationChapter 11: Interrupt On Change
Chapter 11: Interrupt On Change The last two chapters included examples that used the external interrupt on Port C, pin 1 to determine when a button had been pressed. This approach works very well on most
More informationInterrupts and Serial Communication on the PIC18F8520
Interrupts and Serial Communication on the PIC18F8520 Kyle Persohn COEN 4720 Fall 2011 Marquette University 6 October 2011 Outline 1 Background Serial Communication PIC18 Interrupt System 2 Customizing
More informationInterfacing a Hyper Terminal to the Flight 86 Kit
Experiment 6 Interfacing a Hyper Terminal to the Flight 86 Kit Objective The aim of this lab experiment is to interface a Hyper Terminal to 8086 processor by programming the 8251 USART. Equipment Flight
More informationTimer0..Timer3. Interrupt Description Input Conditions Enable Flag
Timer0..Timer3 Timers are pretty useful: likewise, Microchip provides four different timers for you to use. Like all interrupts, you have to Enable the interrupt, Set the conditions of the interrupt, and
More informationUp to three (3) RIO-RS232 modules may be attached to one RIO-PBA Profibus adapter.
General Protocol Issues The RIO-RS232 module consumes 32 bytes of input and output data on Profibus. A fragmentation protocol is used for transferring serial data, requiring that a ladder program be written
More informationApplication Note One Wire Digital Output. 1 Introduction. 2 Electrical Parameters for One Wire Interface. 3 Start and Data Transmission
Application Note One Wire Digital Output 1 Introduction The pressure transmitter automatically outputs pressure data, and when appropriate temperature data, in a fixed interval. The host simply waits for
More informationRFM Bit Level Radio for Sensor Networks. CS 603: Sensor Networks Dr. Gupta Febuary 5, 2004 Presented by: Eric DeKoekkoek
CS 603: Sensor Networks Dr. Gupta Febuary 5, 2004 Presented by: Eric DeKoekkoek The RFM TR1000 Low Power Radio Transceiver For the Mica Mote 916 Mhz Operation 115 Kbps in Amplitude-Shift Keyed modulation
More information8051 Peripherals. On-Chip Memory Timers Serial Port Interrupts. Computer Engineering Timers
8051 Peripherals On-Chip Memory Timers Serial Port Interrupts Computer Engineering 2 2-1 8051 Timers 8051 Timers The 8051 has 2 internal 16-bit timers named Timer 0 and Timer 1 Each timer is a 16-bit counter
More informationUniversity of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory
University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 6 Experiment 6:Timers Objectives To become familiar with hardware timing
More informationUART Implementation Using the N2HET
Application Report Lit. umber Month ear UART Implementation Using the 2HET Haixiao Weng MCU Safety Application ABSTRACT This application report describes how the Hercules 2HET peripheral can be used to
More information8051 Timers and Serial Port
8051 Timers and Serial Port EE4380 Fall 2001 Class 10 Pari vallal Kannan Center for Integrated Circuits and Systems University of Texas at Dallas Timer: Mode 1 Operation (recap) 16 bit counter. Load the
More informationTIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */
The codes below which help in better understanding of timers and counters. I have tested this code for atmega32. I have taken reference from www.avrfreaks.net. Hope you all will find this useful. Darsh
More informationSerial communication
Serial communication CSCI 255: Introduction to Embedded Systems Keith Vertanen Copyright 2011 Serial communication Terminology RS-232 protocol Baud rates Flow control Example Overview Develop functions
More informationInterrupts. How can we synchronize with a peripheral? Polling
Interrupts How can we synchronize with a peripheral? Polling run a program loop continually checking status of the peripheral wait for it to be ready for us to communicate with it Then handle I/O with
More informationUsing Input Capture on the 9S12
The 9S12 Input Capture Function Huang Sections 8.1-8.5 ECT_16B8C Block User Guide o Interrupts on the 9S12 o Capturing the time of an external event o The 9S12 Input Capture Function o Registers used to
More informationSerial Communication. Transmit. Receive To EECC250 - Shaaban. From Universal Asynchronous Receiver/Transmitter (UART) Parity Bit
Parity Bit ASCII Character From 68000 Transmit Transmitter Buffer (TB) Serial Communication Receive To 68000 ASCII Character Parity Bit To device Parity Bit ASCII Character Receiver Buffer (RB) Universal
More informationAN-1435 APPLICATION NOTE
APPLICATION NOTE One Technology Way P.O. Box 9106 Norwood, MA 02062-9106, U.S.A. Tel: 781.329.4700 Fax: 781.461.3113 www.analog.com Implementing UART Using the ADuCM3027/ADuCM3029 Serial Ports INTRODUCTION
More informationBy the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab
By the end of Class Pseudo-code for Lab 1-2 due as part of prelab Homework #5 on website due before next class Outline Introduce Lab 1-2 Counting Timers on C8051 Interrupts Laboratory Worksheet #05 Copy
More informationTimer 32. Last updated 8/7/18
Last updated 8/7/18 Basic Timer Function Delay Counter Load a value into a counter register The counter counts Down to zero (count down timer) Up from zero (count up timer) An action is triggered when
More informationBare Metal Application Design, Interrupts & Timers
Topics 1) How does hardware notify software of an event? Bare Metal Application Design, Interrupts & Timers 2) What architectural design is used for bare metal? 3) How can we get accurate timing? 4) How
More information11 ASYNCHRONOUS SERIAL PORTS
11 ASYNCHRONOUS SERIAL PORTS 11.1 General The ETRAX 100LX contains four complete asynchronous serial receivers/ transmitters with full buffering and parity control. Each asynchronous serial port has one
More informationMicrocontroller Overview
Microcontroller Overview Microprocessors/Microcontrollers/DSP Microcontroller components Bus Memory CPU Peripherals Programming Microcontrollers vs. µproc. and DSP Microprocessors High-speed information
More informationELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC
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
More informationME 6405 Introduction to Mechatronics
ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Microchip PIC Manufacturer Information: Company: Website: http://www.microchip.com Reasons for success: Became the hobbyist's
More informationChapter 10 Sections 1,2,9,10 Dr. Iyad Jafar
Starting with Serial Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar Outline Introduction Synchronous Serial Communication Asynchronous Serial Communication Physical Limitations Overview of PIC 16 Series The
More informationAN-145 ARINC 429 / SPI Demonstration board HI-3585, HI-3598/HI-3599 Applications Note
December 2017 AN-145 ARINC 429 / SPI Demonstration board HI-3585, HI-3598/HI-3599 Applications Note INTRODUCTION The Holt HI-3598 and HI-3599 are silicon gate CMOS ICs for interfacing eight ARINC 429 receive
More informationInterrupts on PIC18F252 Part 2. Interrupts Programming in C Language
Interrupts on PIC18F252 Part 2 Interrupts Programming in C Language Programming interrupts in C language using XC8 compiler is significantly simplified compared to C18 compiler. This note explains the
More informationUsing UART in radio data transmission with the CDP-02 module By Tomihiko Uchikawa
Using UART in radio data transmission with the CDP-02 module By Tomihiko Uchikawa Abstract: The first time a customer uses the CDP-TX-02N/RX-02N (called CDP-02 module) radio module, they are often uncertain
More informationUNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002. Semester 2. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J2. Time allowed: 3 Hours
UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 Semester 2 Year 2 MICROCONTROLLER SYSTEMS Module Code: EEE305J2 Time allowed: 3 Hours Answer as many questions as you can. Not more than TWO questions
More informationCoDeSys Library Extension for EASY242 Applications. FBE - Library. Reference Guide for use with EASY242
CoDeSys FBE - Library Reference Guide for use with EASY242 frenzel + berg electronic GmbH & Co. KG Turmgasse 4 89073 Ulm Germany - phone +49(0)731/970 570 - fax +49(0)731/970 5739 www.frenzel-berg.de FbeE242Libraries_rev2.doc
More informationCHAPTER 5 REGISTER DESCRIPTIONS
USER S MANUAL 5 CHAPTER 5 REGISTER DESCRIPTIONS 5. INTRODUCTION This section describes the functions of the various bits in the registers of the SCC (Tables 5- and 5-2). Reserved bits are not used in this
More informationInterrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF.
Interrupts The Real Time Interrupt Interrupt vectors for the 68HC912B32 The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. These vectors are programmed into Flash EEPROM
More informationHow to use RFpro in Packet Mode
How to use RFpro in Packet Mode Jumper Setting Priority Jumper J1 à Configuration Mode Jumper à Higher Priority Jumper J2 à Packet Mode Jumper à Lower Priority When both the jumpers are connected, by default,
More information2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II
2.996/6.971 Biomedical Devices Design Laboratory Lecture 6: Microprocessors II Instructor: Dr. Hong Ma Oct. 1, 2007 Structure of MSP430 Program 1. Declarations 2. main() 1. Watch-dog timer servicing 2.
More informationARINC-429/575 Interface to VME - Sy429VME-RT32
ARINC-429/575 Interface to - Sy429-RT32 Summary features ARINC-429 and 575 compatible Modular Architecture Expandable to 32 Channels per card FIFO Rx & Tx data buffers Time-Stamping of Rx data Loop-Back
More information8051 Serial Communication
8051 Serial Communication Basics of serial communication Parallel: transfers eight bits of data simultaneously over eight data lines expensive - short distance fast Serial : one bit at a time is transferred
More informationM68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1
M68HC08 Microcontroller The MC68HC908GP32 Babak Kia Adjunct Professor Boston University College of Engineering Email: bkia -at- bu.edu ENG SC757 - Advanced Microprocessor Design General Description The
More informationLecture 10. Serial Communication
Lecture 10 Serial Communication Serial Communication Introduction Serial communication buses Asynchronous and synchronous communication UART block diagram UART clock requirements Programming the UARTs
More informationEET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing
EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing Objectives Explain serial communication protocol Describe data transfer rate and bps rate Describe the main registers used by serial communication
More informationChapter 2. Overview of Architecture and Microcontroller-Resources
Chapter 2 Overview of Architecture and Microcontroller-Resources Lesson 4 Timers, Real Time Clock Interrupts and Watchdog Timer 2 Microcontroller-resources Port P1 Port P0 Port P2 PWM Timers Internal Program
More informationAN10210 Using the Philips 87LPC76x microcontroller as a remote control transmitter
CIRCUITS ITEGRATED CIRCUITS ABSTRACT This application note illustrates the use of an 87LPC76x microcontroller from Philips Semiconductors as an infrared RC5 remote control transmitter. Using the Philips
More informationSection 21. UART UART HIGHLIGHTS. This section of the manual contains the following major topics:
21 Section 21. UART UART HIGHLIGHTS This section of the manual contains the following major topics: 21.1 Introduction...21-2 21.2 Control Registers... 21-3 21.3 UART Baud Rate Generator (BRG)... 21-9 21.4
More informationLaboratory Exercise 4
Laboratory Exercise Input/Output in an Embedded System The purpose of this exercise is to investigate the use of devices that provide input and output capabilities for a processor. There are two basic
More informationDigital Input and Output
Digital Input and Output Topics: Parallel Digital I/O Simple Input (example) Parallel I/O I/O Scheduling Techniques Programmed Interrupt Driven Direct Memory Access Serial I/O Asynchronous Synchronous
More informationUNIVERSITY OF BOLTON SCHOOL OF ENGINEERING B.ENG (HONS) ELECTRICAL AND ELECTRONIC ENGINEERING EXAMINATION SEMESTER /2016
UNIVERSITY OF BOLTON TW59 SCHOOL OF ENGINEERING B.ENG (HONS) ELECTRICAL AND ELECTRONIC ENGINEERING EXAMINATION SEMESTER 1-2015/2016 INTERMEDIATE EMBEDDED SYSTEMS MODULE NO: EEE5004 Date: Thursday 14 January
More informationEE4390 Microprocessors
EE4390 Microprocessors Lessons 23, 24 - Exceptions - Resets and Interrupts Revised: Aug 1, 2003 1 - Exceptions - Resets and Interrupts Polling vs. Interrupts Exceptions: Resets and Interrupts 68HC12 Exceptions
More informationFBE - Library. Reference Guide for use with EASY242 & EASY2606
CoDeSys FBE - Library Reference Guide for use with EASY242 & EASY2606 frenzel + berg electronic GmbH & Co. KG Turmgasse 4 89073 Ulm Germany - phone +49(0)731/970 570 - fax +49(0)731/970 5739 www.frenzel-berg.de
More informationSchool of Computer Science Faculty of Engineering and Computer Science Student ID Number. Lab Cover Page. Lab Date and Time:
Student Information First Name School of Computer Science Faculty of Engineering and Computer Science Last Name Student ID Number Lab Cover Page Please complete all fields: Course Name: Structure and Application
More informationUNIVERSITY OF BOLTON SCHOOL OF ENGINEERING. BEng(Hons) Electrical and Electronics Engineering SEMESTER 1 EXAMINATION 2016/2017
TW34 UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BEng(Hons) Electrical and Electronics Engineering SEMESTER 1 EXAMINATION 2016/2017 INTERMEDIATE EMBEDDED SYSTEMS MODULE NO: EEE5004 Date: Thursday 12 January
More informationUSART. USART stands for Universal Synchronous Asynchronous Receiver Transmitter. Full-duplex NRZ asynchronous serial data transmission
USART 1 USART USART stands for Universal Synchronous Asynchronous Receiver Transmitter Full-duplex NRZ asynchronous serial data transmission Offer wide ranges of baud rate 2 Serial communication Can support
More informationFreescale Semiconductor, I. EKB Applications MC Document Location: EKB Datacomms Server / Product Info / MC68302 Info / Power Measurements
K e l v i n I n d. E s t a t e. E a s t K i l b r i d e, S c o t l a n d. G 7 5 0 T G. EKB Applications Power Measurements on the MC68302 Document ID: Power Measurements on the MC68302 Document Location:
More informationQBridge. I2C, SPI, CAN Control Software User s Manual. Date: Rev 1.3
QBridge I2C, SPI, CAN Control Software User s Manual Date: 9-10-2005 Rev 1.3 1. Introduction...1 1.1. What QBridge can do?... 1 1.2. Disclaimer... 1 1.3. Operational Format... 1 1.4. QBridge-V2... 1 2.
More informationPIC-I/O Multifunction I/O Controller
J R KERR AUTOMATION ENGINEERING PIC-I/O Multifunction I/O Controller The PIC-I/O multifunction I/O controller is compatible with the PIC-SERVO and PIC-STEP motor control modules and provides the following
More informationEmbedded Systems Programming and Architectures
Embedded Systems Programming and Architectures Lecture No 10 : Data acquisition and data transfer Dr John Kalomiros Assis. Professor Department of Post Graduate studies in Communications and Informatics
More informationAsynchronous Data Transfer
Asynchronous Data Transfer In asynchronous data transfer, there is no clock line between the two devices Both devices use internal clocks with the same frequency Both devices agree on how many data bits
More informationAddressing scheme to address a specific devices on a multi device bus Enable unaddressed devices to automatically ignore all frames
23. USART 23.1 Features Full-duplex operation Asynchronous or synchronous operation Synchronous clock rates up to 1/2 of the device clock frequency Asynchronous clock rates up to 1/8 of the device clock
More informationThe MC9S12 Input Capture Function
The MC9S12 Input Capture Function The MC9S12 allows you to capture the time an external event occurs on any of the eight Port T PTT pins An external event is either a rising edge or a falling edge To use
More information4511 MODBUS RTU. Configuration Manual. Solenoid / alarm driver. No. 9203MCM100(1328)
4511 MODBUS RTU Configuration Manual Solenoid / alarm driver 9203MCM100(1328) 9203 CONTENTS Introduction... 3 Modbus basics... 3 Modbus RTU... 3 Supported Function Codes... 3 Modbus Parameters and factory
More informationMicro-Controller: PIC16C74 < Part 5: Interrupt >
Micro-Controller: PIC16C74 < Part 5: Interrupt > I. Overview Introduction PIC16c74 can have many sources of interrupt. These sources generally include one interrupt source for each peripheral module, though
More informationConcepts of Serial Communication
Section 6. Serial Communication Communication Using Serial Interfaces: UART and SPI Concepts of Serial Communication Limitations of Parallel Bus Clock skew becomes a serious issue for high speed and long
More informationMore PIC Programming. Serial and parallel data transfer External busses Analog to digital conversion
More PIC Programming Serial and parallel data transfer External busses Analog to digital conversion Serial vs. Parallel Data Transfer MSD LSD b7 b6 b5 b4 b3 b2 b1 b0 Data Byte Serial Data Transfer Parallel
More informationSection 13. Timer0 HIGHLIGHTS. Timer0. This section of the manual contains the following major topics:
Section 13. Timer0 HIGHLIGHTS This section of the manual contains the following major topics: 13.1 Introduction... 13-2 13.2 Control Register... 13-3 13.3 Operation... 13-4 13.4 Timer0 Interrupt... 13-5
More informationWatchdog Timer. The Basics. The watchdog timer operates independent of the CPU, peripheral subsystems, and even the clock of the MCU.
Watchdog Timer The Basics The watchdog timer watches over the operation of the system. This may include preventing runaway code or in our C example, a lost communications link. The watchdog timer operates
More informationLecture 9. Timer Operations and Programming
Lecture 9 Timer Operations and Programming Timer Operations and Programming Introduction Summary of timers Timer programming sequence Summary of timer SFRs Timer 0-1: 8-bit auto-reload mode (mode 2) Programming
More information