TSic TM Temperature Sensor IC Application Notes ZACwire Digital Output

Similar documents
SPI. Overview and Use of the PICmicro Serial Peripheral Interface. Getting Started: SPI

PIC Programming in Assembly. (

10-bit Σ ADC from a PIC16F84

AN727. Credit Card Reader Using a PIC12C509 DATA ENCODING INTRODUCTION FIGURE 1: POSITION OF ISO TRACKS 1, 2 AND 3. Andrew M Errington

Section 29. Instruction Set

Section 14. Compare/Capture/PWM (CCP)

How To Program A Microcontroller With Memory On A Microchip Microcontroller

I 2 C Master Mode Overview and Use of the PICmicro MSSP I 2 C Interface with a 24xx01x EEPROM

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

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

Serial Communications

Using The PIC I/O Ports

Analog-to-Digital Converters

DS1621 Digital Thermometer and Thermostat

DS1621 Digital Thermometer and Thermostat

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

CHAPTER 11: Flip Flops

PACKAGE OUTLINE DALLAS DS2434 DS2434 GND. PR 35 PACKAGE See Mech. Drawings Section

Real-Time Clock. * Real-Time Computing, edited by Duncan A. Mellichamp, Van Nostrand Reinhold

AN585. A Real-Time Operating System for PICmicro Microcontrollers INTRODUCTION. Why do I Need a Real-Time Kernel? What is Multitasking Anyway?

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

Memory organization. Memory blocks: Program memory (flash-type) 16 kword (32 kbyte) (instruction 16 bit wide) Data RAM 1536 byte (1.

Section 28. In-Circuit Serial Programming (ICSP )

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

Application Note 120 Communicating Through the 1-Wire Master

Measurement and Analysis Introduction of ISO7816 (Smart Card)

PIC in Practice. A Project-Based Approach. D. W. Smith

Section bit A/D Converter

8051 MICROCONTROLLER COURSE

AVR Timer/Counter. Prof Prabhat Ranjan DA-IICT, Gandhinagar

c0003 A Simple PIC Application CHAPTER 3

MICROPROCESSOR AND MICROCOMPUTER BASICS

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

DS Wire Digital Thermometer and Thermostat

Serial Communications

Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II

Part Number Description Packages available

Objectives. Basics of Serial Communication. Simplex vs Duplex. CMPE328 Microprocessors (Spring ) Serial Interfacing. By Dr.

RS - SPM. Serial parallel translator module

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

2011, The McGraw-Hill Companies, Inc. Chapter 3

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

NB3H5150 I2C Programming Guide. I2C/SMBus Custom Configuration Application Note

Measuring Resistance Using Digital I/O

ADS9850 Signal Generator Module

RDF1. RF Receiver Decoder. Features. Applications. Description. Ordering Information. Part Number Description Packages available

The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

8051 Serial Port. Crystal TXD. I/O Device RXD. Embedded Systems Peripherals

FM75 Low-Voltage Two-Wire Digital Temperature Sensor with Thermal Alarm

1. The demonstration code is sending garbage to my terminal program. What are the recommended settings?

HDMM01 V1.0. Dual-axis Magnetic Sensor Module With I 2 C Interface FEATURES. Signal Path X

DS1821 Programmable Digital Thermostat and Thermometer

USB2.0 <=> I2C V4.4. Konverter Kabel und Box mit Galvanischetrennung

Section bit A/D Converter

AN736. An I 2 C TM Network Protocol for Environmental Monitoring THE I 2 C BUS SPECIFICATION INTRODUCTION

Transport Layer Protocols

MODULE BOUSSOLE ÉLECTRONIQUE CMPS03 Référence :

Software User Guide UG-461

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

NHD-0420D3Z-FL-GBW-V3

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

Hello, and welcome to this presentation of the STM32L4 reset and clock controller.

Application Note 83 Fundamentals of RS 232 Serial Communications

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

Microprocessor & Assembly Language

SSPBUF. Shift Clock SSPSR. START bit, STOP bit, Acknowledge Generate

DDR subsystem: Enhancing System Reliability and Yield

DS18B20 Programmable Resolution 1-Wire Digital Thermometer

DS1307ZN. 64 x 8 Serial Real-Time Clock

Project 4: Pseudo USB Simulation Introduction to UNIVERSAL SERIAL BUS (USB) STANDARD

Timer A (0 and 1) and PWM EE3376

8254 PROGRAMMABLE INTERVAL TIMER

4 Character 5x7 LED Matrix Display

RS-485 Protocol Manual

MBP_MSTR: Modbus Plus Master 12

Evo Laser Firmware Developer s Manual

CoE3DJ4 Digital Systems Design. Chapter 4: Timer operation

AND8336. Design Examples of On Board Dual Supply Voltage Logic Translators. Prepared by: Jim Lepkowski ON Semiconductor.

Four-Channel Digital Voltmeter with Display and Keyboard. 8 x 220W RB0 RB1 RB2 RB3 RB4 RB5 RB6 RB7 RA0 RA1 RA2 RA3 PIC16C71

Serial Communications / Protocol in AirTest Products

M25P05-A. 512-Kbit, serial flash memory, 50 MHz SPI bus interface. Features

INTERNATIONAL TELECOMMUNICATION UNION

Interrupts and the Timer Overflow Interrupts Huang Sections What Happens When You Reset the HCS12?

Simple Alarm System WIRELESS AND REMOTE CONTROLLED PERSONAL APPLIANCE CODE WORD ORGANIZATION TRANSMISSION FORMAT

Designing an Induction Cooker Using the S08PT Family

Section 9. I/O Ports

DAC Digital To Analog Converter

8051 Flash Microcontroller. Application Note. A Digital Thermometer Using the Atmel AT89LP2052 Microcontroller

Technical Support Bulletin Nr.18 Modbus Tips

EnDat 2.2 Bidirectional Interface for Position Encoders

CENTRONICS interface and Parallel Printer Port LPT

Monitoring of Intravenous Drip Rate

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

Introduction to Microcontrollers

Technical Data Sheet UM-005. UM005-doc In reference to UM005-c-01.04

PIC12F508/509/16F505 Data Sheet

1.Eastron SDM220Modbus Smart Meter Modbus Protocol Implementation V1.0

LM75 Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface

UART IP Core Specification. Author: Jacob Gorban

Transcription:

TSic TM Temperature Sensor IC Application Notes ACwire Digital Output

CONTENTS 1 TSicTM ACwire Communication Protocol...3 1.1 Temperature Transmission Packet from a TSicTM...3 1.2 Bit Encoding...4 1.3 How to Read a Packet...4 1.4 How to Read a Packet using a µcontroller...5 1.4.1 How Often Does the TSicTM Transmit?...5 1.4.2 Solutions if Real Time System Cannot Tolerate the TSicTM Interrupting the µcontroller...5 2 Appendix A: An Example of PIC1 Assembly Code for Reading the ACwire...6 page 2

1 TSic TM ACwire Communication Protocol ACwire is a single wire bi-directional communication protocol. The bit encoding is similar to Manchester in that clocking information is embedded into the signal (falling edges of the signal happen at regular periods). This allows the protocol to be largely insensitive to baud rate differences between the two ICs communicating. In end-user applications. the TSic TM will be transmitting temperature information, and another IC in the system (most likely a Controller) will be reading the temperature data over the ACwire. 1.1 Temperature Transmission Packet from a TSic TM The TSic TM transmits 1-byte packets. These packets consist of a start bit, 8 data bits, and a parity bit. The nominal baud rate is 8kHz (125microsec bit window). The signal is normally high. When a transmission occurs, the start bit occurs first followed by the data bits (MSB first, LSB last). The packet ends with an even parity bit. The TSic TM provides temperature data with 11-bit resolution, and obviously these 11- bits of information cannot be conveyed in a single packet. A complete temperature transmission from the TSic TM consists of two packets. The first packet contains the most significant 3-bits of temperature information, and the second packet contains the least significant 8-bits of temperature information. There is a single bit window of high signal (stop bit) between the end of the first transmission and the start of the second transmission. page 3

1.2 Bit Encoding The bit format is duty cycle encoded: Start bit => 50% duty cycle used to set up strobe time Logic 1 => 75% duty cycle Logic 0 => 25% duty cycle Perhaps the best way to show the bit encoding is with an oscilloscope trace of a ACwire transmission. The following shows a single packet of 96Hex being transmitted. Because 96Hex is already even parity, the parity bit is zero. 1.3 How to Read a Packet When the falling edge of the start bit occurs, measure the time until the rising edge of the start bit. This time (Tstrobe) is the strobe time. When the next falling edge occurs, wait for a time period equal to Tstrobe, and then sample the ACwire signal. The data present on the signal at this time is the bit being transmitted. Because every bit starts with a falling edge, the sampling window is reset with every bit transmission. This means errors will not accrue for bits downstream from the start bit, as it would with a protocol such as RS232. It is recommended, however, that the sampling rate of the ACwire signal when acquiring the start bit be at least 16x the nominal baud rate. Because the nominal baud rate is 8kHz, a 128kHz sampling rate is recommended when acquiring Tstrobe. page 4

1.4 How to Read a Packet using a µcontroller It is best to connect the ACwire signal to a pin of the μcontroller that is capable of causing an interrupt on a falling edge. When the falling edge of the start bit occurs, it causes the μcontroller to branch to its ISR. The ISR enters a counting loop incrementing a memory location (Tstrobe) until it sees a rise on the ACwire signal. When Tstrobe has been acquired, the ISR can simply wait for the next 9 falling edges (8-data, 1-parity). After each falling edge, it waits for Tstrobe to expire and then sample the next bit. The ACwire line is driven by a strong CMOS push/pull driver. The parity bit is intended for use when the ACwire is driving long (>2m) interconnects to the μcontroller in a noisy environment. For systems in which the noise environment is more friendly, the user can choose to have the μcontroller ignore the parity bit. In the appendix of this document is sample code for reading a TSic TM ACwire transmission using a PIC16F627 μcontroller. 1.4.1 How Often Does the TSic TM Transmit? If the TSic TM is being read via an ISR, how often is it interrupting the μcontroller with data? The update rate of the TSic TM can be programmed to one of 4 different settings: 250Hz, 10Hz, 1Hz, and 0.1Hz. Servicing a temperature-read ISR requires about 2.7ms. If the update rate of the TSic TM is programmed to 250Hz, then the μcontroller spends about 66% of its time reading the temperature transmissions. If, however, the update rate is programmed to something more reasonable like 1Hz, then the µcontroller spends about 0.27% of its time reading the temperature transmissions. 1.4.2 Solutions if Real Time System Cannot Tolerate the TSic TM Interrupting the µcontroller Some real time systems cannot tolerate the TSic TM interrupting the μcontroller. The μcontroller must initiate the temperature read. This can be accomplished by using another pin of the μcontroller to supply VDD to the TSic TM. The TSic TM will transmit its first temperature reading approximately 65-85ms after power up. When the μcontroller wants to read the temperature, it first powers the TSicTM using one of its port pins. It will receive a temperature transmission approximately 65 to 85ms later. If during that 85ms, a higher priority interrupt occurs, the μcontroller can simply power down the TSic TM to ensure it will not cause an interrupt or be in the middle of a transmission when the high priority ISR finishes. This method of powering the TSic TM has the additional benefit of acting like a power down mode and reducing the quiescent current from a nominal 150μA to zero. The TSic TM is a mixed signal IC and provides best performance with a clean VDD supply. Powering through a μcontroller pin does subject it to the digital noise present on the μcontroller s power supply. Therefore it is best to use a simple RC filter when powering the TSic TM with a μcontroller port pin. See the diagram below. page 5

2 Appendix A: An Example of PIC1 Assembly Code for Reading the ACwire In the following code example, it is assumed that the ACwire pin is connected to the interrupt pin (PORTB, 0) of the PIC and that the interrupt is configured for falling edge interruption. This code should work for a PIC running between 2-12MHz. TEMP_HIGH EQU 0X24 ;; MEMORY LOCATION RESERVED FOR TEMP HIGH BYTE TEMP_LOW EQU 0X25 ;; MEMORY LOCATION RESERVED FOR TEMP LOW BYTE ;; THIS BYTE MUST BE CONSECUTIVE FROM TEMP_HIGH LAST_LOC EQU 0X26 ;; THIS BYTE MUST BE CONSECUTIVE FROM TEMP_LOW TSTROBE EQU 0X26 ;; LOCATION TO STORE START BIT STROBE TIME. ORG 0X004 ;; ISR LOCATION CODE TO SAVE ANY NEEDED STATE AND TO DETERMINE THE SOURCE OF THE ISR GOES HERE. ONCE YOU HAVE DETERMINED THE SOURCE IF THE INTERRUPT WAS A AC WIRE TRANSMISSION THEN YOU BRANCH TO AC_TX AC_TX: MOVLW TEMP_HIGH ;; MOVE ADDRESS OF TEMP_HIGH (0X24) TO W REG MOVWF FSR ;; FSR = INDIRECT POINTER, NOW POINTING TO TEMP_HIGH GET_TLOW: MOVLW 0X02 ;; START TSTROBE AT 02 TO ACCOUNT FOR MOVWF TSTROBE ;; OVERHEAD IN GETTING TO THIS POINT OF ISR CLRF INDF ;; CLEAR THE MEMORY LOCATION POINTED TO BY FSR STRB: INCF TSTROBE,1 ;; INCREMENT TSTROBE BTFSC STATUS, ;; IF TSTROBE OVERFLOWED TO ERO THEN RTI ;; SOMETHING WRONG AND RETURN FROM INTERRUPT BTFSS PORTB,0 ;; LOOK FOR RISE ON AC WIRE STRB ;; IF RISE HAS NOT YET HAPPENED INCREMENT TSTROBE CLRF BIT_CNT ;; MEMORY LOCATION USED AS BIT BIT_LOOP: CLRF STRB_CNT ;; MEMORY LOCATION USED AS STROBE CLRF TIME_OUT ;; MEMORY LOCATION USED FOR EDGE TIME OUT page 6

WAIT_FALL: BTFSS PORTB,0 ;; WAIT FOR FALL OF AC WIRE PAUSE_STRB ;; NEXT FALLING EDGE OCCURRED TIME_OUT,1 ;; CHECK IF EDGE TIME OUT OVERFLOWED RTI ;; EDGE TIME OUT OCCURRED. WAIT_FALL PAUSE_STRB: INCF STRB_CNT,1 ;; INCREMENT THE STROBE MOVF TSTROBE,0 ;; MOVE TSTROBE TO W REG SUBWF STRB_CNT,0 ;; COMPARE STRB_CNT TO TSTROBE BTFSS STATUS, ;; IF EQUAL THEN IT IS TIME TO STROBE PAUSE_STRB ;; AC WIRE FOR DATA, OTHERWISE KEEP COUNTING LENGTH OF THIS LOOP IS 6-STATES. THIS HAS TO MATCH THE LENGTH OF THE LOOP THAT ACQUIRED TSTROBE BCF STATUS,C ;; CLEAR THE CARRY BTFSC PORTB,0 ;; SAMPLE THE AC WIRE INPUT BSF STATUS,C ;; IF AC WIRE WAS HIGH THEN SET THE CARRY RLF INDF,1 ;; ROTATE CARRY=AC WIRE INTO LSB OF REGISTER ;; THAT FSR CURRENTLY POINTS TO CLRF TIME_OUT ;; CLEAR THE EDGE TIMEOUT WAIT_RISE: BTFSC PORTB,0 ;; IF RISE HAS OCCURRED THEN WE ARE DONE NEXT_BIT TIME_OUT,1 WAIT_RISE ;; INCREMENT THE EDGE TIME OUT RTI ;; EDGE TIME OUT OCCURRED. NEXT_BIT: INCF BIT_CNT,1 ;; INCREMENT BIT MOVLW 0X08 ;; THERE ARE 8-BITS OF DATA SUBWF BIT_CNT,0 ;; TEST IF BIT AT LIMIT BTFSS STATUS, ;; IF NOT ERO THEN GET NEXT BIT BIT_LOOP CLRF TIME_OUT ;; CLEAR THE EDGE TIME OUT WAIT_PF: BTFSS PORTB,0 ;; WAIT FOR FALL OF PARITY P_RISE page 7

TIME_OUT,1 WAIT_PF ;; INCREMENT TIME_OUT RTI ;; EDGE TIMEOUT OCCURRED P_RISE: CLRF TIME_OUT ;; CLEAR THE EDGE TIME OUT WAIT_PR: BTFSC PORTB,0 ;; WAIT FOR RISE OF PARITY NEXT_BYTE TIME_OUT,1 WAIT_PR ;; INCREMENT EDGE TIME OUT RTI ;; EDGE TIME OUT OCCURRED NEXT_BYTE: INCF FSR,1 ;; INCREMENT THE INDF POINTER MOVLW LAST_LOC SUBWF FSR,0 ;; COMPARE FSR TO LAST_LOC BTFSS STATUS, ;; IF EQUAL THEN DONE WAIT_TLOW IF HERE YOU ARE DONE READING THE AC WIRE AND HAVE THE DATA IN TEMP_HIGH & TEMP_LOW WAIT_TLOW: CLRF TIME_OUT WAIT_TLF: TFSS PORTB,0 ; WAIT FOR FALL OF PORTB,0 INDICATING RTI: GET_TLOW ; START OF TEMP LOW BYTE TIME_OUT WAIT_TLF RTI ; EDGE TIMEOUT OCCURRED TORE ANY STATE SAVED OFF AT BEGINNING OF ISR BCF INTCON,INTF ;; CLEAR INTERRUPT FLAG BSF INTCON,INTE ;; ENSURE INTERRUPT RE-ENABLED RETFI E ;; RETURN FROM INTERRUPT page 8

The technical information in this document has been checked with adequate care at our end and is intended to inform about the product and its applications. The descriptions are not to be understood as assurance of the defined characteristics of the product and should be checked by the user for the intended application. Any possible industrial third party patent rights are to be considered. Issued October 2008 - This documentation supersedes all previous editions. Copyright 2008 HYGROSENS INSTRUMENTS GmbH. All rights reserved.