Another thought - does the 100 ms or 200 ms pulse need to be aligned with anything in particular? The AC zero-crossings are either 8.33 or 10 ms apart (60 Hz/50 Hz), both of which divide nicely into 100 ms.
P. Short wrote:Another thought - does the 100 ms or 200 ms pulse need to be aligned with anything in particular? The AC zero-crossings are either 8.33 or 10 ms apart (60 Hz/50 Hz), both of which divide nicely into 100 ms.
Actually, that should work. I'm just sending out a signal so the timing isn't overly critical. I'll just have to find a place in the code where I can count the crossings.
Just an update...
I decided to go with Phil's suggestion of counting the Zero Crosses(or timer1 overflows for DC). It seems to be working pretty well so far. I haven't tested it using AC yet but it is working well using DC. I'm fairly sure I'll get similar results when I test it in my RenSS8 but I won't know for sure until I actually test it.
Thanks for all the input I got on this.
Well, my over confidence that it would work using using an AC build got me again. It's not really important for my project but now it's just getting under my skin. Just wondering if anyone has a real quick ideas why it wouldn't work with AC.
Basically, all I've done is in the interupt I've basically raised a flag when the ZC or timer1 counter is detected:
do_zc:
bsf tx_state,0 ; raise a pseudo flag for interrupt
movlw CTR_LOCKOUT ; dead periods for dimmest possible values
movwf ctr_timeslot
Then in the mainloop I just check for the flag, and use that to count the number of Zero Crosses. In the case of using DC and needing to count to 100ms I'm counting 10 Zero Crosses(timer1 overflows).
This is working great using DC(which, again, is what I really need). When I run it using an AC build(I'm at 60Hz here) I'm expecting that do_zc should be getting called at 8.33ms intervals(so my counter should count to 12) but it seems to be getting called much faster than that. It appears that I have to count to 255 to get close to 100ms.
It's very possible the issue is elsewhere in my code but in theory I'm counting the ZC's in correct place in code, right?
I'm thinking that in your implementation with TIMER1, the electrical ZC can easily be in a completely different phase than the TIMER1 counter, and that's why it's not working. If TIMER1 were initially synced to the electrical ZC so they coincided, I'd think it would likely work. Just my .03 (inflation...)
