Professional Documents
Culture Documents
19, Innovation First Road Science Park Hsin-Chu Taiwan 300 R.O.C. Tel: 886-3-578-6005 Fax: 886-3-578-4418 E-mail: mcu@sunplus.com
http://www.sunplusmcu.com
http://mcu.sunplus.com
Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLOGY CO. is believed to be accurate and reliable. However, SUNPLUS No TECHNOLOGY CO. makes no warranty for any errors which may appear in this document. Contact SUNPLUS TECHNOLOGY CO. to obtain the latest version of device specifications before placing your order. responsibility is assumed by SUNPLUS TECHNOLOGY CO. for any infringement of patent or other rights of third parties which may result from its use. In addition, SUNPLUS products are not authorized for use as critical components in life support systems or aviation systems, where a malfunction or failure of the product may reasonably be expected to result in significant injury to the user, without the express written approval of Sunplus.
PAGE 1
Revision History
Translated By Li Jing Li Jing Proofreading Translate Zero Cross Detection V1.1, Chinese version Page Number(s)
Remark
PAGE 2
Table of Content
PAGE
1 System Design.................................................................................................................................... 4 1.1 System Design Description ........................................................................................................... 4 1.2 System Block Diagram .................................................................................................................. 4 1.3 MCU Resource .............................................................................................................................. 4 2 Hardware Design ................................................................................................................................ 6 2.1 Function......................................................................................................................................... 6 2.2 Design Principle............................................................................................................................. 6 2.3 Time Error Between Interrupt Generation Point and Actual Zero Point of AC220V ...................... 8 3 Software Description.......................................................................................................................... 9 3.1 Source File .................................................................................................................................... 9 3.2 Subroutines ................................................................................................................................... 9 3.3 Variables ...................................................................................................................................... 10 4 Flowcharts..........................................................................................................................................11 4.1 Main Flowchart .............................................................................................................................11 4.2 Interrupt Subroutine......................................................................................................................11 4.3 Display Subroutine ...................................................................................................................... 12
PAGE 3
1 System Design
1.1 System Design Description
This document is intended to guide you how to detect the zero crossing point for AC220V on SUNPLUS SPMC65x series. Here we use SPMC65P2404A*28P as an example for demonstration purpose.
IRQ0
Transform
Commute
SPMC65P2404A *28P
6 LEDs showing
16MHz
PAGE 4
PAGE 5
2 Hardware Design
2.1 Function
This application is taking SPMC65P2404A*28P as the main controller to detect the zero crossing point of AC220V through the external interrupt on SUNPLUS SPMC65x series, which mainly performs the following three functions. Triac trigger. Through detecting the zero crossing point, the turn-on time of triac can be controlled, thus to control the voltage. Relay protection. When using relay to control AC220V power on/off, if the relay is closed around the peak voltage of AC220V, a larger spark will occur thus to shorten the relay lifetime and generate the electromagnetic interference (EMI); if closed at the zero crossing point, these influences will be decreased. Timing. AC220V has a frequency of 50Hz and a period of 20ms. After performing the full-wave rectification, the interrupt occurs at each zero crossing point at a 10ms interval.
10ms on, 10ms off, synchronize with the zero point of power supply LED1 25HZ blink:
20ms on, 20ms off, synchronize with the zero point of power supply
Sunplus Technology Co., Ltd. PAGE 6 V1.2 - Nov 01 2006