Friday, September 13, 2013
Sunday, August 25, 2013
Shift Register and Feedback Node
Shift Register and Feedback Node have the similar function that is used to store the data after execute the loop and transmit to next loop.
Monday, August 12, 2013
电容降压的工作原理、计算以及注意事项
电容降压
1、工作原理
电容降压是利用电容在一定的交流信号频率下产生的容抗来限制最大工作电流。在理想电容器上并不产生功耗,如果电容是一个理想电容,则流过电容的电流为虚部电流,它所作的功为无功功率。根据这个特点,我们如果在一个电容器上再串联一个阻性元件,则阻性元件两端所得到的电压和它所产生的功耗完全取决于这个阻性元件的特性。因此,电容降压实际上是利用容抗限流。而电容器实际上起到一个限制电流和动态分配电容器和负载两端电压的角色。电容降压具有功耗低,成本低等优点。当然缺点也有,缺点在后面的注意事项中说明。
2、容抗计算
Xc = 1/(ω*C)= 1/(2*π*f*C);
Xc--------电容容抗值;欧姆
ω---------角频率
π---------3.14;
f---------频率,对工频是50HZ;
C---------电容值 法拉
本设计即采用C12与C15进行分压,大部分电压降落在C15两端。现在计算分压情况
Xc15=(1/(2*∏*50*470))*1000000000=6.772KΩ
Xc12=(1/(2*∏*50*10))*1000000000=318KΩ
先计算后仿真
…………(待补充)
3、注意事项
(1)未和220V交流高压隔离,请注意安全,严防触电!
(2)限流电容必须采用无极性电容,须接于火线,耐压要足够大(大于400V),并加串防浪涌冲击兼保险电阻和并放电电阻。
(3)注意齐纳管功耗,严禁齐纳管断开运行。
(4)根据负载的电流大小和交流电的工作频率选取适当的电容,而不是依据负载的电压和功率。
(5)电容降压不能用于大功率条件,一般在100mA下使用,因为不安全。
(6)电容降压不适合动态负载条件,电容降压不适合容性和感性负载。
(7)当需要直流工作时,尽量采用半波整流。不建议采用桥式整流。而且要满足恒定负载的条件。
单片机系统中的掉电检测与数据存储问题
下面是我在电能表系统中的方案与分析:
2.掉电检测与数据存储
1)总体思路
由于电能表的计量是要求持续性的,而主供电系统不可能是持续的,注意这里需要一个掉电检测与数据存储的问题。首先检测出供电系统已经断电,然后启用备用电源存储数据,而且数据必须存储在掉电不易失的存储器(如EEPROM,FLASH等)中。
本应用中,需要检测出掉电后备用电源能提供足够的电能供单片机进行数据存储。总体思路,本应用中单片机采用的是STC89C58RD+,单片机内部已经集成了16K的EEPROM,所以不需要另外外接存储器。ADE7755已经自带了电源监控功能,前面的ADE7755的介绍中已经有所描述,所以亦无须担心。这里只需要解决好单片机的掉电问题即可。在系统的稳压前端设置监测点,当监测点的电压下降到另一个基准比较电压时产生单片机外部中断。当单片机接收到外部中断后启动数据存储程序,将数据存储到片内EEPROM内。当主供电系统恢复供电后,单片机首先读取EEPROM数据,然后再恢复计数。
2)掉电检测
有电压采集转换、电压比较等方案。经过综合考虑,这里采用LM393比较器来对比监测点与参考点电压,一旦监测点电压降到某种程度,比较器就会有高电平输出,由此产生单片机外部中断。
另外有一种反其道而行之的方案。在降压后的交流端加一个光耦产生中断,一旦中断消失程序转向数据存储。
3)备用电源
虽然备用电源可以采用可充电电池,大电容等方案,但由于这里所需要的电量并不是很大,持续时间也不需要很长,只需要能完成数据存储即可。所以这里选择了大电容作为备用电源这一方案。选择了在稳压后端与单片机电源端直接并联了两个达3300uF的大容量电解电容。同时,为安全起见,在单片机的电源输入端还串入了一个低正向压降压降的二极管来阻止大电容向除单片机意外的其他电路放电。
4)数据存储
不可易失存储方案很多,比如EEPROM,FLASH,铁电等。但Flash读写比较麻烦,铁电也需要另加外围器件,所以这里选择单片机内置的EEPROM无疑是最好的选择。不仅读写简单方便,可多次擦写,减少外围器件与单片机IO口,而且为备用电源减轻了很大的负担。
最后,需要说明的是,实际上现在很多高档单片机已经集成上述功能。比如AVR自带的BOD(Brown-out Detection)电路,内置模拟比较器,C8051F系列自带AD而且在掉电时自动产生中断。也有独立的专用复位芯片,如TPS3705,ISL88706等。
5)理论计算
(1)按恒流充放电的简化计算:Q = CV = IT.Q是电量,C是电容量,V是电压,I是电流,T是时间
那么T=CV/I,在本例中可以估算时间为 T= 0.0033f*(5.0V-3.8V) / 0.012A = 0.33s,即330ms. 330/8.5 = 38.8mS,即最多可以保存38字节数据到EEPROM中,38字节对于本应用已经足够。
数据说明:
单片机在3.8V到5.5V之间工作正常;单片机的工作电流典型值是4mA;最大工作电流20mA;普通外置EEPROM的读写一个字节的时间是8.5mS左右。据下面引述资料显示,此计算是保守估算,故可靠性有所保证。
STC单片机datasheet上是这样描述的:
1.同一次修改的数据放在同一扇区中,不是同一次修改的数据放在另外的扇区,就不须读出保护。2.如果一个扇区只用一个字节,那就是真正的EEPROM,STC 单片机的Data Flash 比外部EEPROM 要快很多,读一个字节/ 编程一个字节大概是0.2uS/60uS。3.如果在一个扇区中存放了大量的数据,某次只需要修改其中的一个字节或一部分字节时,则另外的不需要修改的数据须先读出放在STC单片机的RAM中,然后擦除整个扇区,再将需要保留的数据和需修改的数据一并写回该扇区中。这时每个扇区使用的字节数是使用的越少越方便(不需读出一大堆需保留数据)。
Thursday, July 25, 2013
[worklog] miss the TestStand vi, named "Close Termination Monitor.vi" etc
Background
Test team report that software can't run normally, after check the software and find that miss 3 subVIs and 1 custom-control.
• TestStand - Initialize Termination Monitor.vi
• TestStand - Get Termination Monitor Status.vi
• TestStand - Close Termination Monitor.vi
These 3 VIs locate in system folder, under ...Addon/<TestStand>...
Why miss these 3 system VIs?
When install the TestStand and LabVIEW at the same PC, must follow the correct order. Install LabVIEW at first, and then TestStand.
Reference:
1.http://forums.ni.com/t5/LabVIEW/Missing-Teststand-Vi-s-with-new-Labview-Teststand-install/m-p/1597348
2.http://www.ni.com/pdf/manuals/373200b.pdf Page 6-9
Tuesday, July 23, 2013
[worklog] 4-wire test failed analysis report
Thursday, June 27, 2013
[worklog] LED check, color sensor introduction
1. TCS3414
TCS3414 digital color light sensors are designed to accurately derive the color chromaticity and illuminance (intensity) of ambient light and provide a digital output with 16-bits of resolution. The devices include an 8 × 2 array of filtered photodiodes, analog-to-digital converters, and control functions on a single monolithic CMOS integrated circuit. Of the 16 photodiodes, 4 have red filters, 4 have green filters, 4 have blue filters, and 4 have no filter (clear). With the advanced patent pending in-package trim capability, device-to-device and system-to-system tolerance can be minimized allowing very precise repeatability to be attained.
2. TSL252R
TSL252R are light-to-voltage optical sensors, each combining a photodiode and a transimpedance amplifier (feedback resistor = 16 MΩ, 8 MΩ, and 2.8 MΩ respectively) on a single monolithic IC. Output voltage is directly proportional to the light intensity (irradiance) on the photodiode. These devices have improved amplifier offset-voltage stability and low power consumption and are supplied in a 3-lead clear plastic sidelooker package with an integral lens. When supplied in the lead (Pb) free package, the device is RoHS compliant.
3. TSL237T
The TSL237T light-to-frequency converter combines a silicon photodiode and a current-to-frequency converter on a single monolithic CMOS integrated circuit. Output is a square wave (50% duty cycle) with frequency directly proportional to light intensity (irradiance) on the photodiode. The digital output allows direct interface to a microcontroller or other logic circuitry. Output enable (OE) places the output in a high-impedance state for multiple-unit sharing of a microcontroller input line. The device has been temperature compensated for the ultraviolet-to-visible light range of 320 nm to 700 nm and responds over the light range of 320 nm to 1050 nm. The TSL237T is characterized for operation over the temperature range of
4. BH1621FVC
BH1621FVC is an analog current output ambient light sensor. This IC is the most suitable to obtain the ambient light data for adjusting LCD and Keypad backlight of mobile phone for power saving. It is always used to check LED.
5. OPT101
The OPT101 is a monolithic photodiode with on-chip Tran impedance amplifier. Output voltage increases linearly with light intensity. The amplifier is designed for single or dual power-supply operation, making it ideal for battery operated equipment. The integrated combination of photodiode and Tran impedance amplifier on a single chip eliminates the problems commonly encountered in discrete designs such as leakage current errors, noise pick-up, and gain peaking due to stray capacitance. The 0.09 x 0.09 inch photodiode is operated in the photoconductive mode for excellent linearity and low dark current. The OPT101 operates from +2.7V to +36V supplies and quiescent current is only 120μA. It is available in clear plastic 8-pin DIP, and J-formed DIP for surface mounting. Temperature range is
Sunday, June 16, 2013
[work log] U1 (C8051F501) reprogramming failure analysis report (upload figure)
Good Board
|
NG Board
| |||
PIN#
|
Connected
|
Disconnected
|
Connected
|
Disconnected
|
#1
|
3.3
|
3.3
|
3.3
|
3.3
|
#2
|
0
|
0
|
0
|
0
|
#3
|
0
|
0
|
0
|
0
|
#4
|
5
|
5
|
5
|
5
|
#5
|
2.5
|
2.5
|
2.5
|
2.5
|
#6
|
2.5
|
2.5
|
2.5
|
2.5
|
#7
|
5
|
5
|
0~0.999
|
5
|
#8
|
0
|
0
|
0
|
0
|
#9
|
0
|
0
|
0
|
0
|
#10
|
5
|
-3.3
|
5
|
-3.3
|
Measure the voltage between GND by DMM
|
Item
|
Sample #
|
U1 Signal Pin
|
Picture name#
|
Status
|
1
|
OK(L12A008367)
|
PIN12
|
ALL0000/ALL0001
|
Connected
|
2
|
OK(L12A008367)
|
PIN11
|
ALL0002/ALL0003
|
Connected
|
3
|
OK(L12A008367)
|
PIN11
|
ALL0004
|
Disconnected
|
4
|
NG(L12A008354)
|
PIN12
|
ALL0005
|
Connected
|
5
|
NG(L12A008354)
|
PIN11
|
ALL0006/ALL0007/ALL0008/ALL0009
|
Connected
|
6
|
NG(E13A021033)
|
PIN12
|
ALL0010/ALL0011
|
Connected
|
7
|
NG(E13A021033)
|
PIN11
|
ALL0012
|
Connected
|
[work log]U1 (C8051F501) reprogramming failure analysis report
Good Board
|
NG Board
| |||
PIN#
|
Connected
|
Disconnected
|
Connected
|
Disconnected
|
#1
|
3.3
|
3.3
|
3.3
|
3.3
|
#2
|
0
|
0
|
0
|
0
|
#3
|
0
|
0
|
0
|
0
|
#4
|
5
|
5
|
5
|
5
|
#5
|
2.5
|
2.5
|
2.5
|
2.5
|
#6
|
2.5
|
2.5
|
2.5
|
2.5
|
#7
|
5
|
5
|
0~0.999
|
5
|
#8
|
0
|
0
|
0
|
0
|
#9
|
0
|
0
|
0
|
0
|
#10
|
5
|
-3.3
|
5
|
-3.3
|
Measure the voltage between GND by DMM
|
![]() |

Item
|
Sample #
|
U1 Signal Pin
|
Picture #
|
Status
|
1
|
OK(L12A008367)
|
PIN12(Reset/clk)
|
ALL0000/ALL0001
|
Connected
|
2
|
OK(L12A008367)
|
PIN11(Data)
|
ALL0002/ALL0003
|
Connected
|
3
|
OK(L12A008367)
|
PIN11
|
ALL0004
|
Disconnected
|
4
|
NG(L12A008354)
|
PIN12
|
ALL0005
|
Connected
|
5
|
NG(L12A008354)
|
PIN11
|
ALL0006/ALL0007/ALL0008/ALL0009
|
Connected
|
6
|
NG(E13A021033)
|
PIN12
|
ALL0010/ALL0011
|
Connected
|
7
|
NG(E13A021033)
|
PIN11
|
ALL0012
|
Connected
|



