Trying to realize a circuit for an inverted
y found the following problem: the 12F675 that I use would work at 60 hz. but seem to me that is working at one fourst that speed, this is the program:
' PROGRAM FOR 60 Hz. INVERTER
#chip 12F675, 4
#config BODEN_OFF, MCLRE_OFF, INTRC_OSC_NOCLKOUT
dir gpio b'11111100' ' pins 0 and 1 config as output
gpio = b'11111100' ' put then low
#define OUT1 gpio.0
#define OUT2 gpio.1
do
SET OUT1 on
WAIT 8 ms ' 8.333 ms each half cicle, 16.666 ms full cicle
WAIT 30 10us ' ( 8 + .300 + .033 ) ms
wait 33 us
SET OUT1 off
SET OUT2 on
WAIT 8 ms
wait 30 10us
wait 33 us
SET OUT2 off
loop
Thanks in advance for your help!!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Reading 1/4 of what you expect is wrong. Compiling and running your program came up with something like 55.4 hz on my radio shack dvm. By manually adjusting code to 7.55 ms came up with 60 hz. Using an internal rc clock for precise timing is being very optimistic.
One factor concerning the internal oscillator is whether the factory calibration has been maintained. Read the value from the last byte of program memory, and write it down before programming. My osc was recalibrated by a Pickit 2 programmer and look at the result. What happens when you have wide variations in temperature?
I think it is fair to say that GCBasic timing shcemes were developed with a 20mhz crystal. That is, whenever there are questions about wait states, check them with a 20 mhz crystal clock and you will probably be not far off.
So as a baseline, the 60 hz program was loaded up in a 16f88, with a 20 mhz crystal for a clock. The result was a 59.9 hz signal using a 8.30 ms wait.
Recalibrate your internal osc, or try a fresh 12f675, after you write down the factory calibration number. Put a crystal on it, and adjust as required for timing critical operations.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok! Kent, I suspect some thing about of that you refer, but I find the very real problem, it was the variables that I used: out1 and out2, I changed this and the problem dissapear, on some site would be a list of reserved word for GCBASIC. Your comment about precision timing will be put in practic, thank you, another time, for your valuable help...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Trying to realize a circuit for an inverted
y found the following problem: the 12F675 that I use would work at 60 hz. but seem to me that is working at one fourst that speed, this is the program:
' PROGRAM FOR 60 Hz. INVERTER
#chip 12F675, 4
#config BODEN_OFF, MCLRE_OFF, INTRC_OSC_NOCLKOUT
dir gpio b'11111100' ' pins 0 and 1 config as output
gpio = b'11111100' ' put then low
#define OUT1 gpio.0
#define OUT2 gpio.1
do
SET OUT1 on
WAIT 8 ms ' 8.333 ms each half cicle, 16.666 ms full cicle
WAIT 30 10us ' ( 8 + .300 + .033 ) ms
wait 33 us
SET OUT1 off
SET OUT2 on
WAIT 8 ms
wait 30 10us
wait 33 us
SET OUT2 off
loop
Thanks in advance for your help!!
Reading 1/4 of what you expect is wrong. Compiling and running your program came up with something like 55.4 hz on my radio shack dvm. By manually adjusting code to 7.55 ms came up with 60 hz. Using an internal rc clock for precise timing is being very optimistic.
One factor concerning the internal oscillator is whether the factory calibration has been maintained. Read the value from the last byte of program memory, and write it down before programming. My osc was recalibrated by a Pickit 2 programmer and look at the result. What happens when you have wide variations in temperature?
I think it is fair to say that GCBasic timing shcemes were developed with a 20mhz crystal. That is, whenever there are questions about wait states, check them with a 20 mhz crystal clock and you will probably be not far off.
So as a baseline, the 60 hz program was loaded up in a 16f88, with a 20 mhz crystal for a clock. The result was a 59.9 hz signal using a 8.30 ms wait.
Recalibrate your internal osc, or try a fresh 12f675, after you write down the factory calibration number. Put a crystal on it, and adjust as required for timing critical operations.
Ok! Kent, I suspect some thing about of that you refer, but I find the very real problem, it was the variables that I used: out1 and out2, I changed this and the problem dissapear, on some site would be a list of reserved word for GCBASIC. Your comment about precision timing will be put in practic, thank you, another time, for your valuable help...