ELAN Home Systems EM78P458AP, EM78P459AK, EM78P459AM manual PWM Period Prdx PRD1 or PRD2, Comparator

Page 39

EM78P458/459

OTP ROM

3. PWM Period ( PRDX : PRD1 or PRD2 )

The PWM period is defined by writing to the PRDX register. When TMRX is equal to PRDX, the following events occur on the next increment cycle:

TMRX is cleared.

The PWMX pin is set to 1.

The PWM duty cycle is latched from DT1/DT2 to DTL1/DTL2. < Note > The PWM output will not be set, if the duty cycle is 0;

The PWMXIF pin is set to 1.

The following formula describes how to calculate the PWM period:

PERIOD = (PRDX + 1) * 4 * (1/Fosc) * (TMRX prescale value )

4.PWM Duty Cycle ( DTX: DT1H/ DT1L and DT2H/ DT2L; DTL: DL1H/DL1L and DL2H/DL2L )

The PWM duty cycle is defined by writing to the DTX register, and is latched from DTX to DLX while TMRX is cleared. When DLX is equal to TMRX, the PWMX pin is cleared. DTX can be loaded at any time. However, it cannot be latched into DTL until the current value of DLX is equal to TMRX.

The following formula describes how to calculate the PWM duty cycle:

Duty Cycle = (DTX) * (1/Fosc) * (TMRX prescale value )

5. Comparator X

To change the output status while the match occurs, the TMRXIF flag will be set at the same time.

6.PWM Programming Procedures/Steps

(1)Load PRDX with the PWM period..

(2)Load DTX with the PWM Duty Cycle.

(3)Enable interrupt function by writing IOCF0, if required.

(4)Set PWMX pin to be output by writing a desired value to IOC51.

(5)Load a desired value to IOC51 with TMRX prescaler value and enable both PWMX and TMRX.

This specification is subject to change without prior notice.

39

07.01.2003 (V1.3)

Image 39
Contents BIT MICRO-CONTROLLER EM78P458/459Application Note EM78P458/459General Description Features EM78P458/459 PIN Assignment EM78P459 Pin Description R1 Time Clock /Counter Function DescriptionOperational Registers R0 Indirect Addressing RegisterProgram Counter Organization R7 ~ R8 R3 Status RegisterR4 RAM Select Register R5 ~ R6 Port 5 ~ PortData Memory Configuration 11. RC R9 Adcon Analog to Digital ControlRA Addata the converted value of ADC 10. RB15. R10 ~ R3F Special Purpose Registers13. RE RF Interrupt Status RegisterBit 0 PSR0 ~ Bit 2 PSR2 TCC/WDT prescaler bits Control RegisterIOC50 ~ IOC60 I/O Port Control Register Inte INT PAB PSR2 PSR1 PSR0IOC90 Gcon I/O Configuration & Control of ADC OP2E OP1EVrefs COE IMS2 IMS1 IMS0 CKR1 CKR0 IMS2IMS0 Description of AD Configuration Control BitsIOCB0 Pull-down Control Register Bit4Bit2 IMS2IMS0IOCD0 Pull-high Control Register IOCC0 Open-Drain Control RegisterCmpie PWM2IE PWM1IE Adie Exie Icie Tcie IOCE0 WDT Control RegisterIOCF0 Interrupt Mask Register Wdte EISPWM2E PWM1E T2EN T1EN IOC51 PwmconCALI2 SIGN2 IOC81 PRD1 Period of PWM1CALI1 SIGN1 Bit 5Bit 3 VOF12VOF10 Offset voltage bitsBit 5Bit 3 VOF22VOF20 Offset voltage bits IOCB1 PRD2 Period of PWM2TCC/WDT & Prescaler I/O Ports Block Diagram of TCC and WDTCcircuit of I/O Port and I/O Control Register for Port Circuit of I/O Port and I/O Control Register for P60~P67 Reset and Wake-up Function of Reset and Wake-upUsage of Port 6 Input Changed Wake-up/Interrupt Function Contw CLR R1 Status of T, and P of Status Register Status of RST, T and P being Affected by Events Values of RST, T, and P after ResetInterrupt Interrupt Input Circuit Analog-To-Digital Converter ADCADCON/R9 BIT Symbol Iocs Adrun Adpd ADIS2 ADIS1 ADIS0BIT Symbol Vrefs COE IMS2 IMS1 IMS0 CKR1 CKR0 ADC Control Register ADCON/R9, AD-CMP-CON/IOCA0, GCON/IOC90Shows the Gains and the Operating Range of ADC ADC Data Register ADDATA/RACKR1 and CKR0 Bit 1 and Bit 0 The conversion time select GCON/IOC90Programming Steps/Considerations D Operation During Sleep ModeD Sampling Time D Conversion TimeCINT== 0XF Demonstration Programs Iocs Adrun Adpd ADIS2 ADIS1 ADIS0 Overview Dual Sets of PWM Pulse Width ModulationFunctional Block Diagram of the Dual PWMs Increment Timer Counter Tmrx TMR1H/TWR1L or TMR2H/TWR2LPeriod = Prdx + 1 * 4 * 1/Fosc * Tmrx prescale value PWM Programming Procedures/StepsPWM Period Prdx PRD1 or PRD2 ComparatorPrdx PRD1 and PRD2 PWM period register TimerFunction description TMR1X and TMR2X TMR1H/TWR1L and TMR2H/TMR2LProgramming the Related Registers Timer programming procedures/stepsExternal Reference Signal ComparatorUsing as An Operation Amplifier Wake-up from Sleep ModeInterrupt Summary of the Initialized Values for Registers Initialized Values after ResetCALI1 SIGN1 Oscillator Modes OscillatorEM78P459 Crystal Oscillator/Ceramic Resonators XtalSummary of Maximum Operating Speeds EM78P458Vdd HXTLXT EM78P458 EM78P459External RC Oscillator Mode EM78P458 EM78P459 Vcc Rext RC Oscillator Mode with Internal CapacitorEM78P458 EM78P459 Rin Power-on ConsiderationsExternal Power on Reset Circuit Residue-Voltage ProtectionEnwdt Clks PTB HLF RCT HLP Code Option Register WordBit 11 ~ Bit 9 VOF22~VOF20 Offset voltage bits Bit 5 ~ Bit 0 ID5~ID0 Customer’s IDList of the instruction set of EM78P458/459 Instruction SetADD A,R TCC Input Timing CLKS=0 Timing DiagramsReset Timing CLK=0 AC Test Input/Output WaveformAbsolute Maximum Ratings Crystal type, two clocks Electrical CharacteristicsAC Electrical CharacteristicTa=0C ~ 70 C, VDD=5V±5%, VSS=0V ComparatorOP CharacteristicVdd = 5.0V,Vss=0V,Ta=0 toIVR DIP AppendixPackage Types OTP MCU