Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to alter 60Hz signal on T0CKI every 1/120th second?

Status
Not open for further replies.

deperkin

Member level 2
Joined
Apr 12, 2009
Messages
47
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,776
I currently have AC(L) and a 2Mohm resistor connected to T0CKI and would like to get an accurate 60Hz reading from the wall outlet.

Is there a way to connect the AC line like this and interrupt on T0CKI so that every 1/120th second I can alter the AC signal?

i.e. I have this connected to an AC motor and would like to create a dimming type circuit. I have my PIC connected to a solid-state relay as well.

Can I get the timer0 to use this external source and interrupt every 1/120th second?


Thank you as always.
 

60Hz signal on T0CKI

would like to get an accurate 60Hz reading from the wall outlet.

what does that mean?
 

Re: 60Hz signal on T0CKI

i am connecting a main AC line to a 2 megoohm resistor for a zero-crossing circuit.
This is connected to T0CKI.

I am wondering the best way to go about using this input for a fan speed controller.

I also have this main line connected to port B for a general interrupt-on-change.

does anyone have a recommended way I should proceed on this?

some simple code:

#include <18F2331.H>
#include <STDLIB.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, NOPUT, NOLVP, NOMCLR
#ocs 500 kHz
int16 fanL, fanspeed;
int8 portB;

#INT_RB
void AC_isr(){
disable_interrupts(int_RB);
portB = input_b()
output_low(PIN_C2); //MOTOR
delay_us(fanL);
output_toggle(PIN_C4); //LED
output_high(PIN_C2); //MOTOR
}

void main() {
SET_TRIS_A(0xFF); //PINS A0-A7 are inputs
SET_TRIS_B(0xFF); //PINS B0-B7 are inputs
while(TRUE){
enable_interrupts(INT_RB);
enable_interrupts(GLOBAL);
fanspeed = 0x0F & input_a();
switch(fanspeed){
case 10:fanL=0;break;
case 9: fanL=58;break;
case 8: fanL=1515;break;
case 7: fanL=2272;break;
case 6: fanL=3030;break;
case 5: fanL=3788;break;
case 4: fanL=4545; break;
case 3: fanL=5303;break;
case 2: fanL=6060;break;
case 1: fanL=6818;break;
case 0: fanL=7576; break;
default: fanL= 0; break;
}
}
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top