CY8C29/27/24/23/21xxx, CY8CLED02/04/08/16, CY8CLED0xD, CY8CLED0xG, CY8C28x45, CY8CPLC20, CY8CLED16P01, CY8C28xxx. Main UM

Similar documents
DMX512 Receiver Datasheet DMX512Rx V 1.0. Features and Overview

CY7C603xx CYWUSB

24-Bit Pseudo Random Sequence Generator Data Sheet

CapSense I 2 C/SPI Timer Flash RAM

For one or more fully configured, functional example projects that use this user module go to

8 to 1 Analog Multiplexer Datasheet AMux8 V 1.1. Features and Overview

LPF (Optional) CY8C24x93. Without LPF and ISR to 3* With LPF only** to 3* With ISR only to 3*

Programmable Gain Amplifier Datasheet PGA V 3.2. Features and Overview

32-Bit Counter Datasheet Counter32 V 2.5. Features and Overview

Shadow Registers Datasheet ShadowRegs V 1.1. Features and Overview

Supported Devices: CY8C28x13, CY8C28x33, CY8C28x43, CY8C28x45, CY8C28x52, CY8C21x45, CY8C22x45, CY8C24x93. CY8C24x

Preliminary. Gas Sensor Analog Front End Datasheet GasSensorAFE V Features and Overview. This datasheet contains Preliminary information.

4 to 1 Analog Multiplexer Data Sheet

Use the Status Register when the firmware needs to query the state of internal digital signals.

This optional pin is present if the Mode parameter is set to SyncMode or PulseMode. Otherwise, the clock input does not show.

Programmable Threshold Comparator Data Sheet

For one or more fully configured, functional example projects that use this user module go to

Use the Status Register when the firmware needs to query the state of internal digital signals.

Incremental ADC Data Sheet

For one or more fully configured, functional example projects that use this user module go to

16-Bit Hardware Density Modulated PWM Data Sheet

This optional pin is present if the Mode parameter is set to SyncMode or PulseMode. Otherwise, the clock input does not show.

PSoC Blocks. CY8C20xx6/6A/6AS/6H/6L, CY8C20xx7/7S, CY7C643xx, CY7C604xx, CYONS2xxx, CYONSxNxxxx, CYRF89x35, CY8C20065, CY8C24x93, CY7C69xxx

Writing to Internal Flash in PSoC 3 and PSoC 5

Comparator (Comp) Features. General Description. When to use a Comparator 1.60

Voltage Reference (Vref) Features. General Description. Input/Output Connections. When to Use a Vref Voltage references and supplies

CE56273 Associated Part Families: CY8C38xx/CY8C55xx Software: PSoC Creator Related Hardware: CY8CKIT-001 Author: Anu M D

PSoC 1 I 2 C Bootloader

Reviving Bit-slice Technology in a Programmable Fashion

Cypress HX2VL Configuration Utility Blaster User Guide

Filter_ADC_VDAC_poll Example Project Features. General Description. Development Kit Configuration

PSoC 4 Low Power Comparator (LPComp) Features. General Description. When to Use a LPComp 2.0. Low input offset. User controlled offset calibration

The color of the Clock component waveform symbol will change based on the clock's domain (as shown in the DWR Clock Editor), as follows:

Use the IDAC8 when a fixed or programmable current source is required in an application.

This Application Note demonstrates an SPI-LIN slave bridge using a PSoC device. Demonstration projects are included.

CE PSoC 4: Time-Stamped ADC Data Transfer Using DMA

6 to 14-Bit Delta Sigma ADC DatasheetDelSigMultiV 1.30

HX2VL Development Kit Guide. Doc. # Rev. **

HX2VL Development Kit Guide. Doc. # Rev. *A

Supported devices: CY8C29x66, CY8C27x43, CY8C28xxx, CY8C24x23, CY8C24x33, CY8C21x23, CY8C21x34, CY8C21x45, CY8C22x45, CY8C24x94

Libraries Guide. Arithmetic Libraries User Guide. Document #: Rev. *A

Comparator Datasheet CMP V 1.1. Features and Overview

Cypress HX2VL Configuration Utility Blaster User Guide

1st Order Modulator nd Order Modulator

AN EZ-USB FX3 I 2 C Boot Option. Application Note Abstract. Introduction. FX3 Boot Options

THIS SPEC IS OBSOLETE

PSoC Creator Component Datasheet

GPIF II Designer - Quick Start Guide

AN SIO Tips and Tricks in PSoC 3 / PSoC 5. Application Note Abstract. Introduction

1st Order Modulator nd Order Modulator

THIS SPEC IS OBSOLETE

EZ I 2 C Slave. Features. General Description. When to use a EZ I 2 C Slave 1.50

Next-Generation Hot-Swap Controllers

The following table lists user modules used in this code example and the hardware resources occupied by each user module.

This optional pin is present if the Mode parameter is set to SyncMode or PulseMode. Otherwise, the clock input does not show.

Triple Input 8-Bit Incremental ADC Datasheet TriADC8 V Features and Overview. See AN2239, ADC Selection Guide for other converters.

CYClockMaker Programming Kit Guide CY3675. Doc. # Rev. **

Use the Status Register when the firmware needs to query the state of internal digital signals.

CY8C29/27/24xxx, CY8CLED04/08/16, CY8CLED0xD, CY8CLED0xG, CY8C28x45, CY8CPLC20, CY8CLED16P01, CY8C28x43, CY8C28x52

CE58957 demonstrates how to implement the fade and toggle feature to the backlight LEDs of CapSense buttons.

CYClockMaker Programming Kit Guide CY3675. Doc. # Rev. *C

This section describes the various input and output connections for the Voltage Fault Detector.

PSoC Designer Release Notes

One 32-bit counter that can be free running or generate periodic interrupts

FTG Programming Kit CY3670. Spec. # Rev. *C

Multifunction Serial Interface (PDL_MFS) Features. General Description. When to Use a PDL_MFS Component. Quick Start 1.0

144-Mbit QDR -II SRAM 2-Word Burst Architecture

Supports one or two address decoding with independent memory buffers. Memory buffers provide configurable Read/Write and Read Only regions

EZ-USB FX3 Development Kit Guide

PSoC Programmer 3.12 Release Notes

Bootloader project - project with Bootloader and Communication components

CY3660-enCoRe V and encore V LV DVK Kit Guide

THIS SPEC IS OBSOLETE

Clock Programming Kit

Automatic reload of the period to the count register on terminal count

7- to 13-Bit Variable Resolution Incremental ADC Datasheet ADCINCVR V 4.00

Optional Pause Pulse for constant frame length of 282 clock ticks

Digital Logic Gates. Features. General Description. Input/Output Connections. When to Use a Logic Gate. Input 1. Input 2. Inputs 3-8 * 1.

FM3 MB9B100A/300A/400A/500A Series Inverter Solution GUI User Guide

PSoC 4 Current Digital to Analog Converter (IDAC)

This section describes the various input and output connections for the Voltage Fault Detector.

AN1090. NoBL : The Fast SRAM Architecture. Introduction. NoBL SRAM Description. Abstract. NoBL SRAM Operation

Use the Status Register when the firmware needs to query the state of internal digital signals.

The AMuxSeq is capable of having between 2 and 32 analog inputs. The paired inputs are present when the MuxType parameter is set to "Differential.

Comparator (Comp) Features. General Description. When to use a Comparator Low input offset. User controlled offset calibration

Capable of adjusting detection timings for start bit and data bit

Triple Input 7- to 13-Bit Incremental ADC Datasheet TriADC V Features and Overview

PSoC 6 Current Digital to Analog Converter (IDAC7)

Voltage Fault Detector (VFD) Features. General Description. Input/Output Connections. When to Use a VFD. Clock Input 2.30

This section describes the various input and output connections for the SysInt Component.

Use a DieTemp component when you want to measure the die temperature of a device.

Digital Multiplexer and Demultiplexer. Features. General Description. Input/Output Connections. When to Use a Multiplexer. Multiplexer 1.

This input determines the next value of the output. The output does not change until the next rising edge of the clock.

Base Timer Channel (BT) Features. General Description. When to Use a PDL_BT Component 1.0

Programmer User Guide

CE95314 PSoC 3, PSoC 4, and PSoC 5LP EZI2C

12-Mbit (512 K 24) Static RAM

DS2430A 256-Bit 1-Wire EEPROM

Setting Oscillation Stabilization Wait Time of the main clock (CLKMO) and sub clock (CLKSO)

Supports a range of speeds of external memories (from 5 to 200 ns) Supports external memory power-down, sleep, and wakeup modes

Transcription:

Datasheet OneWire V 1.1 001-43362 Rev. *I OneWire Copyright 2008-2014 Cypress Semiconductor Corporation. All Rights Reserved. Resources PSoC Blocks API Memory (Bytes) Digital Analog CT Analog SC Flash RAM Pins (per External I/O) CY8C29/27/24/23/21xxx, CY8CLED02/04/08/16, CY8CLED0xD, CY8CLED0xG, CY8C28x45, CY8CPLC20, CY8CLED16P01, CY8C28xxx Main UM 2 0 0 168 1 2 + Optional CRC16 0 0 0 43 2 0 + Optional Search 0 0 0 618 11 0 + Optional Overdrive Speed 0 0 0 45 1 0 + Optional Parasite Power 0 0 0 42 1 0 Features and Overview Requires only two I/O pins to interface multiple slave devices Functions provided support reading and writing of both bits and bytes Function provided for CRC-8 data integrity checking Optional CRC-16 function for ibutton data integrity checking Optional functions provided for performing One-Wire search for handling multiple devices Optional functions provided for overdrive speed supported by some One-Wire devices Optional functions provided for parasite power supported by some One-Wire devices The OneWire User Module is a set of library routines that read and write data as a master using the Maxim Integrated Products 1-Wire protocol. A One-Wire master may communicate with one or many slave devices using only one signal wire and a ground. The master initiates all data transfers. Figure 1. OneWire Block Diagram Cypress Semiconductor Corporation 198 Champion Court San Jose, CA 95134-1709 408-943-2600 Document Number: 001-43362 Rev. *I Revised May 27, 2014

Functional Description The OneWire User Module uses a single I/O pin to interface with One-Wire components over twisted-pair cable. A One-Wire network consists of a master, the wiring, and one or more slave devices. Both master and slave devices are open drain with external pull up. The PSoC I/O should be configured to Resistive Pull up. One-Wire is a proprietary interface developed by Dallas Semiconductor that uses a single wire for both data and power. 1-Wire is a registered trademark of Dallas Semiconductor Corp., a wholly owned subsidiary of Maxim Integrated Products, Inc. For more information on the One-Wire specification, see http://www.maxim-ic.com/. The user module consists of two digital blocks. The BitClk block provides clock for the XCVR block. The clock is different for different working situations. All BitClk control is performed under user module API control. The XCVR block provides all communication at the receive and transmit level. Timing Figure 2. OneWire Timing Diagram Table 1. Timing Value Table Standard Speed Overdrive Speed Parameter Min (µs) Typ (µs) Max (µs) Min (µs) Typ (µs) Max (µs) A 5 6 15 1 1.5 1.85 B 59 64-7.5 7.5 - C 60 60 120 7 7.5 14 D 8 10-2.5 2.5 - E 5 9 12 0.5 0.75 0.85 F 50 55-6.75 7 - G 0 0 0 2.5 2.5 - H 480 480 640 68 70 80 I 63 70 78 7.2 8.5 8.8 J 410 410-39.5 40 - Document Number: 001-43362 Rev. *I Page 2 of 20

Placement The OneWire User Module is composed of two digital blocks XCVR and BitClk. The XCVR block must be placed in the PSoC digital communication block and the BitClk block may be placed in any digital PSoC block to the adjacent left position of the XCVR block. Parameters and Resources Clock The input clock to the user module. It must be 3 MHz for proper interface timing. The Global I/O buses may be used to connect this clock input to an external pin or a clock function generated by a different PSoC block. When using an external digital clock for the block, the row input synchronization should be turned off for best accuracy, and sleep operation. One of the divided clocks, VC1, VC2, or VC3, can also be specified as the clock input. RX TX As a general rule, input through the desired bus option to a source of input data. The input can be connected to one of the external pins using a global bus. The PSoC pins connected to user module RX input and TX output should be connected together externally. The output of the transmitter can be routed to the Global Output Bus. The Global Output Bus can then be connected to an external pin. The pin connected to TX should be configured to pull up mode in order to provide correct user module functioning. The PSoC pins connected to user module RX input and TX output should be externally connected together. CRC Enables or disables the optional CRC-16 functions. If disabled, the code for CRC-16 calculations is not generated to save ROM and RAM space. Search Enables or disables the optional One-Wire search functions. If disabled, some code is eliminated to save ROM and RAM space. OverDrive Enables or disables the optional overdrive speed functions. If disabled, some code is eliminated to save flash and RAM space. Note that not all One-Wire devices support overdrive speed. ParasitePower Enables or disables the optional parasite power functions. If disabled, the code is not generated to save ROM and RAM space. Not all One-Wire devices support parasite power. Note: The global interrupt must be enabled to support parasite power. The interrupt for the digital block is automatically enabled by the user module. ParasitePowerTXPort, ParasitePowerTXPin These parameters select the TX port and pin if the ParasitePower feature is enabled. Set both to if the ParasitePower feature is not used. Document Number: 001-43362 Rev. *I Page 3 of 20

ClockSync In PSoC devices, digital blocks may provide clock sources in addition to the system clocks. Digital clock sources may even be chained in ripple fashion. This introduces skew with respect to the system clocks. This parameter may be used to control clock skew and ensure proper operation when reading and writing PSoC block register values. Appropriate values for this parameter should be determined from the following table. ClockSync Value Sync to SysClk Use Use this setting for any 24 MHz (SysClk) derived clock source that is divided by two or more. Examples include VC1, VC2, VC3 (when VC3 is driven by SysClk), 32 khz, and digital PSoC blocks with SysClk-based sources. Externally generated clock sources should also use this value to ensure that proper synchronization occurs. Sync to SysClk*2 Use this setting for any 48 MHz (SysClk*2) based clock unless the resulting frequency is 48 MHz (in other words, when the product of all divisors is 1). Use SysClk Direct Unsynchronized Use when a 24 MHz (SysClk/1) clock is desired. This does not actually perform synchronization but provides low-skew access to the system clock itself. If selected, this option overrides the setting of the Clock parameter. It should always be used instead of VC1, VC2, VC3 or digital blocks where the net result of all dividers in combination produces a 24 MHz output. Use when the 48 MHz (SysClk*2) input is selected. Use when unsynchronized inputs are desired. In general this use is advisable only when interrupt generation is the sole application of the Counter. InvertRX This parameter determines the sense of the input signal. When "Normal" is selected, the input is active-high. Selecting "Invert" causes the sense to be interpreted as active-low. Interrupt Generation Control There are two additional parameters that become available when the Enable interrupt generation control check box in PSoC Designer is checked. This is available under Project > Settings > Chip Editor. Interrupt Generation Control is important when multiple overlays are used with interrupts shared by multiple user modules across overlays: InterruptAPI The InterruptAPI parameter allows conditional generation of a user module's interrupt service routine (ISR) and interrupt vector table entry. Select "Enable" to generate the ISR and interrupt vector table entry. Select "Disable" to bypass the generation of the ISR and interrupt vector table entry. Properly selecting this parameter is particularly important for projects that have multiple overlays where a single block resource is shared by the different overlays. By enabling Interrupt API generation only when it is necessary, the need to generate interrupt dispatch code is usually eliminated. This reduces code overhead. Document Number: 001-43362 Rev. *I Page 4 of 20

IntDispatchMode The IntDispatchMode parameter is used to specify how an interrupt request is handled for interrupts shared by multiple user modules existing in the same block but in different overlays. Selecting "ActiveStatus" causes firmware to test which overlay is active before servicing the shared interrupt request. This test occurs every time the shared interrupt is requested. This adds latency and also produces a nondeterministic procedure of servicing shared interrupt requests, but does not require any RAM. Selecting "OffsetPreCalc" causes firmware to calculate the source of a shared interrupt request only when an overlay is initially loaded. This calculation decreases interrupt latency and produces a deterministic procedure for servicing shared interrupt requests, but at the expense of a small amount of RAM. Application Programming Interface The Application Programming Interface (API) routines are provided as part of the user module to allow the designer to deal with the module at a higher level. This section specifies the interface to each function together with related constants provided by the include? files. Note In this, as in all user module APIs, the values of the A and X register may be altered by calling an API function. It is the responsibility of the calling function to preserve the values of A and X before the call if those values are required after the call. This registers are volatile policy was selected for efficiency reasons and has been in force since version 1.0 of PSoC Designer. The C compiler automatically takes care of this requirement. Assembly language programmers must ensure their code observes the policy, too. Though some user module API function may leave A and X unchanged, there is no guarantee they may do so in the future. For Large Memory Model devices, it is also the caller's responsibility to preserve any value in the CUR_PP, IDX_PP, MVR_PP, and MVW_PP registers. Even though some of these registers may not be modified now, there is no guarantee that will remain the case in future releases. The API routines allow programmatic control of the OneShot User Module. OneWire_Start Initializes the digital blocks for the OneWire User Module. This function should be called once before the other OneWire functions. void OneWire_Start(void); lcall OneWire_Start Document Number: 001-43362 Rev. *I Page 5 of 20

OneWire_Stop Stops the functioning of the digital blocks for the OneWire User Module. void OneWire_Stop(void); lcall OneWire_Stop OneWire_fReset Reset any attached One-Wire devices and indicates if any devices are present. BYTE OneWire_fReset(void); lcall OneWire_fReset A nonzero value is returned if one or more devices are present. Document Number: 001-43362 Rev. *I Page 6 of 20

OneWire_WriteBit Writes a bit to the One-Wire device. void OneWire_WriteBit(BYTE bdatabit); mov A, [bdatabit] ; the least significant bit of the byte is written lcall OneWire_WriteBit bdatabit: The least significant bit of this byte is written to the One-Wire device. The value is passed in Accumulator. OneWire_bReadBit Reads a bit from a One-Wire device. BYTE OneWire_bReadBit(void); lcall OneWire_bReadBit mov [bdatabit], A The LSB of this byte is the value read from a One-Wire device. The result returns through the Accumulator. Document Number: 001-43362 Rev. *I Page 7 of 20

OneWire_WriteByte Writes a byte to the One-Wire devices. void OneWire_WriteByte( BYTE bdata); mov A, [bdata] ; Load byte lcall OneWire_WriteByte bdata: Byte to be written to the One-Wire devices. Passed through Accumulator. OneWire_bReadByte Reads a byte from a One-Wire device. BYTE OneWire_bReadByte(void); lcall OneWire_bReadByte mov [bdata], A bdata: Byte read from a One-Wire device. Retuned value passed through Accumulator. Document Number: 001-43362 Rev. *I Page 8 of 20

OneWire_ClearCRC8 Clear the byte in RAM which holds the current CRC8 value. This function should be called before calling OneWire_bCRC8 when computing a new CRC value. void OneWire_ClearCRC8(void); lcall OneWire_ClearCRC8 OneWire_bCRC8 Compute a CRC for One-Wire devices. This function should be called for each byte that is part of the CRC value. The current CRC value is returned. Note that the returned CRC value is all zeros when all of the bytes including the CRC from the device are correct and loaded into this function. BYTE OneWire_bCRC8(BYTE bdata); mov A, [bdata] ; Load byte to be included in the CRC value. lcall OneWire_bCRC8 mov [bcrc], A ; use returned CRC. bdata: Data byte to be part of the CRC value. Passed through accumulator. bcrc: The current CRC value. Returned through accumulator. Document Number: 001-43362 Rev. *I Page 9 of 20

OneWire_ClearCRC16 Clear the bytes in RAM which holds the current CRC-16 value. This function should be called before calling OneWire_wCRC16Value when computing a new CRC value. Note that this function is available only if CRC is set to CRC16 in user module parameters. void OneWire_ClearCRC16(void); lcall OneWire_ClearCRC16 ; lcall function OneWire_wCRC16Value Compute a CRC-16 for One-Wire devices. This function should be called for each byte that is part of the CRC-16 value. The current CRC value is returned. Note that the returned CRC value is zero when all of the bytes including the CRC from the device are correct and loaded into this function. Note that this function is available only if CRC is set to CRC16 in user module parameters. WORD OneWire_wCRC16Value(BYTE bdata); mov A, [bdata] ; Load byte to be included in the CRC value. lcall OneWire_wCRC16Value mov [wcrc_lsb], A mov [wcrc_msb], X bdata: Data byte to be part of the CRC value. Is passed through accumulator. The current CRC value. The MSB of the value is located in X and LSB in A registers. Document Number: 001-43362 Rev. *I Page 10 of 20

OneWire_GetROM Each One-Wire device has an 8-byte value called a ROM buffer that contain information about the device. This information includes the device family ID, part ID, and part serial number. All search functions (ffindfirst, ffindnext, fverify, FamilyTarget setup, FamilySkipSetup) use an 8-byte buffer that to compare with the device ROM buffer. This function copies the search function s ROM buffer into an array of 8 bytes. Note that this function is available only if Search is enabled in user module parameters. void OneWire_GetROM(BYTE * pbarray); mov A, >pbarray ; Load MSB part of pointer to RAM based array of 8 bytes. mov X, <pbarray ; Load LSB part of pointer to RAM based array of 8 bytes. lcall OneWire_GetROM pbarray: Pointer to an array of an 8 bytes to copy data from the search function. OneWire_SetROM Each One-Wire device has an 8-byte value called a ROM buffer that contain information about the device. This information includes the device family ID, part ID, and part serial number. All search functions (ffindfirst, ffindnext, fverify, FamilyTarget setup, FamilySkipSetup) use an 8-byte buffer that to compare with the device ROM buffer. This function copies an array of 8 bytes into the search function s buffer. Note that this function is available only if Search is Enabled in user module parameters. void OneWire_SetROM(char * pbarray); mov A, >pbarray ; Load MSB part of pointer to RAM based array of 8 bytes. mov X, <pbarray ; Load LSB part of pointer to RAM based array of 8 bytes. lcall OneWire_SetROM pbarray: Pointer to an array of an 8 bytes to provide data for the search function. Document Number: 001-43362 Rev. *I Page 11 of 20

OneWire_fFindFirst Search for the first One-Wire device. The function initializes the search state and then performs the search. The device ROM number can then be read by the OneWire_GetROM function. Note that this function is available only if Search is Enabled in user module parameters. BYTE OneWire_fFindFirst(void); lcall OneWire_fFindFirst mov [ffinded], A A nonzero value is returned if a device was found. OneWire_fFindNext Search for the next One-Wire device. This function is usually called after a OneWire_fFindFirst or a OneWire_fFindNext. The function performs the search without changing the search state. The device ROM number can then be read by the OneWire_GetROM function. If no additional device is found the function returns a 0 and the search state is set to find the first device the next time a search is performed. Note that this function is available only if Search is Enabled in user module parameters. BYTE OneWire_fFindNext(void); lcall OneWire_fFindNext mov [ffinded], A A nonzero value is returned if a device was found. Document Number: 001-43362 Rev. *I Page 12 of 20

OneWire_fVerify This function determines if a device with a given ROM number is present. The ROM number to verify is input by the OneWire_SetROM function before calling OneWire_fVerify. If the device is present, the function returns a non zero value. Note that this function is available only if Search is Enabled in user module parameters. BYTE OneWire_fVerify(void); lcall OneWire_fVerify : A nonzero value is returned if the device is present. OneWire_FamilyTargetSetup This function presets the search state to first find a particular family type. The ROM number of One- Wire devices begins with a one byte family code. The family code lets the One-Wire master determine the capabilities of the connected devices. This function makes it possible to limit searches to a desired family. When OneWire_fFindNext is called, the first device of the family type is found. The device ROM number can then be read by the OneWire_GetROM function. If no devices of the indicated family are present, then another family type is found. Therefore, the family code of the found ROM number must be examined after the search. Note that this function is available only if Search is Enabled in user module parameters. void OneWire_FamilyTargetSetup(BYTE bfamilytype); mov A, 10h ; Family code to find lcall OneWire_FamilyTargetSetup bfamilytype: The family code byte to be used in the next search. Document Number: 001-43362 Rev. *I Page 13 of 20

OneWire_FamilySkipSetup This function changes the search state to skip all devices of the family code found from the previous search. This function is only useful after a search. It should be called after a search returns a family code that is to be skipped. The searches that follow find devices that come after the current family code. If there are no other family codes that follow, then the search returns the same family code again. The next call to this function sets the search state so that the next search returns a 0. Therefore, the family code should be examined after each search followed by a call to this function if it is a code to be skipped. Note that this function is available only if Search is Enabled in user module parameters. void OneWire_FamilySkipSetup(void); lcall OneWire_FamilySetup OneWire_SetOverdrive This function changes the bit timing to overdrive speed. Note that this function is available only if Overdrive is Enabled in user module parameters. void OneWire_SetOverdrive(void); lcall OneWire_SetOverdrive Document Number: 001-43362 Rev. *I Page 14 of 20

OneWire_ClearOverdrive This function changes the bit timing to normal speed. Call OneWire_Reset after this function to return the One-Wire device(s) to normal speed. Note that this function is available only if Overdrive is Enabled in user module parameters. void OneWire_ClearOverdrive(void); lcall OneWire_ClearOverdrive OneWire_WriteByteStrong This function writes a byte to the One-Wire devices, then immediately sets the output pin to strong mode. This function should be used when devices using parasite power need additional supply current. For example, One-Wire thermometers require additional supply current when performing a temperature conversion. This function switches to strong mode within 10µs of writing the last bit when the CPU clock is set to at least 6 MHz. Note that this function is available only if Parasite Power feature is enabled in user module parameters. void OneWire_WriteByteStrong( BYTE bdata); mov A, 0CCh ; Load byte lcall OneWire_WriteByteStrong bdata: Byte to be written to the One-Wire devices. Document Number: 001-43362 Rev. *I Page 15 of 20

OneWire_SetResistive This functions changes the output pin back to resistive Pull Up mode after call OneWire_WriteByteStrong. Note that this function is available only if Parasite Power feature is enabled in user module parameters. void OneWire_SetResistive(void); lcall OneWire_SetResistive Sample Firmware Source Code Here is a simple assembly and C example for communicating with a One-Wire device: ;;----------------------------------------------------------------- ;; Sample asm OneWire Code ;; ;; Write commands to do a temperature conversion and read the ;; temperature for a single DS18S20 device. ;;----------------------------------------------------------------- include "m8c.inc" include "PSoCAPI.inc" ; PSoC API definitions for all User Modules export _main _main: call OneWire_Start Loop: call OneWire_fReset mov A, CCh call OneWire_WriteByte mov A, 44h call OneWire_WriteByte ; Initialize 1-Wire pin ; reset the 1-Wire device ; "skip ROM command" ; "convert temperature" command ; Wait at least 750 ms for temperature conversion finish call OneWire_fReset mov A, CCh call OneWire_WriteByte ; reset the 1-Wire device ; "skip ROM" command Document Number: 001-43362 Rev. *I Page 16 of 20

mov A, BEh ; "read scratchpad" command call OneWire_WriteByte call OneWire_bReadByte ; read temperature LSB mov REG[PRT1DR], A ; write temperature to Port 1 jmp Loop ret The same functionality using C language: //-------------------------------------------------------------------- // Sample C code for OneWire // // Write commands to do a temperature conversion and read the // temperature for a single DS18S20 device. //-------------------------------------------------------------------- #include "OneWire.h" #include "PSoCAPI.h" void main(void) { OneWire_Start(); // Initialize 1-Wire pin for (;;) { OneWire_fReset(); // reset the 1-Wire device OneWire_WriteByte(0xCC); // "skip ROM" command OneWire_WriteByte(0x44); // "convert temperature" command // Wait at least 750 ms for temperature conversion finish OneWire_fReset(); // reset the 1-Wire device OneWire_WriteByte(0xCC); // "skip ROM" command OneWire_WriteByte(0xBE); // "read scratchpad" command PRT1DR = OneWire_bReadByte(); // read temeperature LSBa and send to P1 } } Document Number: 001-43362 Rev. *I Page 17 of 20

Configuration Registers The One-Wire uses two digital PSoC block named BitClk and XCVR. Each block is personalized and parameterized through 7 registers. The following tables give the personality? values as constants and the parameters as named bit-fields with brief descriptions. Symbolic names for these registers are defined in the user module instance s C and assembly language interface files (the.h and.inc files). Table 2. Block BitClk, Function Register (DxBxxFN), Bank1 BCEN gates the output onto the row broadcast bus line. This bit field is set in the Device Editor by directly configuring the broadcast line Table 3. Block BitClk, Input Register (DxBxxIN), Bank1 Clock selects the input clock from one of 16 sources. This parameter is set in the Device Editor. Table 4. Block BitClk, Output Register (DxBxxOU), Bank1 The user module ClockSync parameter in the Device Editor determines the value of ClockSynk bits. Table 5. Block BitClk, Control Register (DxBxxCR0), Bank0 Start/Stop indicates that the OneWire is enabled when set. It is modified using the OneWire API. Table 6. Value 0 BCEN 1 0 0 0 0 1 Value 0 0 0 1 Clock Value ClockSync 0 0 0 0 0 0 Value 0 0 0 0 0 0 0 Start/Stop Block BitClk, Counter Register (DxBxxDR0), Bank0 Value Down Counter Register Counter register holds current Counter value and is not directly readable or writeble. Table 7. Block BitClk, Period Register (DxBxxDR1), Bank0 Value Period Period register is controlled over User Module API according to current operation type. Table 8. Block BitClk, Compare Register (DxBxxDR2), Bank0 Value 0 0 0 0 0 0 0 0 Compare value. Is not used in current implementation. Document Number: 001-43362 Rev. *I Page 18 of 20

Table 9. Block XCVR, Function Register (DCBxxFN), Bank1 The InvertRX flag, set through a user module parameter displayed in the Device Editor, controls the sense of the RX input signal. BCEN gates the output onto the row broadcast bus line. This bit field is set in the Device Editor by directly configuring the broadcast line. Table 10. Block XCVR, Input Register (DCBxxIN), Bank1 RX selects the input signal of the same name from one of 16 sources. The user module RX parameter setting in the Device Editor determines its value. Table 11. Block XCVR, Output Register (DCBxxOU), Bank1 The user module ClockSync parameter in the Device Editor determines the value of ClockSynk bits. TX selects output from one of four global busses. This parameter is set in the Device Editor. Table 12. Block XCVR, Control Register (DCBxxCR0), Bank0 Overrun flag indicates that RXBuffer register value was overwritten. SPIComplete flag indicates that last data byte was shifted out and all associated clocks was generated. TXRegEmpty flag indicates that previous data byte transferred to Shift register and TXBuffer register is empty. RXRegFull flag indicates that new data byte is received and stored in RXBuffer register. Start/Stop indicates that the OneWire is enabled when set. It is modified using the OneWire API. Table 13. Value InvertRX BCEN 0 0 0 1 1 0 Value RX 0 0 1 1 Value ClockSync 0 0 0 TX Value 0 Overrun SPIComplete TXRegEmpty RXRegFull 0 0 Start/Stop Block XCVR, SPI Shift Register (DCBxxDR0), Bank0 Value Shift Value The SPI shift register. This register is not directly readable or writable. Table 14. Block XCVR, TX Buffer Register (DCBxxDR1), Bank0 Value TX Buffer Transmitter Buffer register. Table 15. Block XCVR, RX Buffer Register (DCBxxDR2), Bank0 Value RX Buffer Receiver Buffer register. Document Number: 001-43362 Rev. *I Page 19 of 20

Version History Version Originator Description 1.1 TDU Updated Clock description to include: When using an external digital clock for the block, the row input synchronization should be turned off for best accuracy, and sleep operation. Note PSoC Designer 5.1 introduces a Version History in all user module datasheets. This section documents high level descriptions of the differences between the current and previous user module versions. Document Number: 001-43362 Rev. *I Revised May 27, 2014 Page 20 of 20 Copyright 2008-2014 Cypress Semiconductor Corporation. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. PSoC Designer and Programmable System-on-Chip are trademarks and PSoC is a registered trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are property of the respective corporations. Any Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress' product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Use may be limited by and subject to the applicable Cypress software license agreement.