??? 11/24/04 10:50 Read: times |
#81821 - Did the changes .... Responding to: ???'s previous message |
Your code is a lot easier to understand now! To confirm the zero cross function, when the ISR thinks it is time for a zero cross, toggle a port pin. Connect one channel of your 'scope to the mains, the other channel to the port pin that gets toggled. Set the scope to trigger off chan1 (mains) and set the volts to 10v so the zero crossing portion has a large slope. Observe the time between the real mains zero cross and the port pin that is your internal zero cross. There will invariably be some variation, but it should fall +/- 100uS - confirm this. If the variation is larger - investigate the cause as this may be your problem. If you need a DSO - use your PC's soundcard with the appropriate input scaling and protection - there's plenty of scope software out there as freeware etc. Whilst the vertical accuracy won't be too good, the timing is pretty sharp and some software have long capture buffers so you can look at a number of cycles. I think you'll be pleasantly surprised. |