# Clashlab

EstablishedMember

6

0 Neutral

• Rank
Newbrie
1. ## Interfacing To Power Lines

Well, what I wanna do is control a triac for light dimming. So I need to know when the power line crosses zero. I don't need a very high accuracy, 100 µs delay will be ok. But I don't want the interrupt to occur at the peak value of the sine curve nor the interrupt occurring at very different times if the sine curve is going down or up. So using a transformer to get a 9v sine curve is not acceptable because (50Hz) : Going from 0 to 1 needs 2v (TTL) => t = arcsin( 2 / 9 )/( 2 * pi * 50 ) = 0.7 ms later Going from 1 to 0 needs 0.8v (TTL) => t = arcsin( 2 / 9 )/( 2 * pi * 50 ) = 0.3 ms earlier This leads to a 1 ms different between two interrupts, on a 50Hz signal that is 10%, it's too much.
2. ## Interfacing To Power Lines

They did answer me: So I will not use that method. Instead I will connect the power line thru a resistor to a NOT gate (which allows exceeding the voltage specifications as long as the current specification is meet, i.e. SN74AHC1G04) and connect that output to the pic (also thru a resistor).
3. ## Interfacing To Power Lines

Hi, I would like to know if I can use the method described in AN521 to detect the power line zero crossing (that is using only a resistor) on a 16F88 using portB pin 7. I don't see the diodes on the datasheet schematic for that pin so I am wondering if I have to put them outside the pic. The reason I choose portB pin 7 is because I need an interrupt on change. Thanks
4. ## Problems Reading Porta In Interrupt

Ok, I will try this! I should have read the datasheet more deeply. Thanks a lot!
5. ## Problems Reading Porta In Interrupt

Hi, The way I connected the led to the pic is very simple: PIC (5v) ---- Resistor (470 Ohm) ---- Led ---- 0v I tried several other value for the resistor, form 47 Ohm to 2.7 kOhm but that doesn't change anything. I think your right about the origin of my problem, it explain the two situation I encountered. I also found that RA4 on a 16f88 is a schmitt trigger, but using RA3 (TTL) doesn't help. So how can I make sure that when I put a 1 on the led output I read a 1 after?