Hello,

I have some puzzling results with PWM -again...
if I have this:

pwm_max_resolution(1)
pwm1_on()
pwm1_set_dutycycle_highres(500)
I get a nice 8kHz square wave.

If I add
pwm_set_frequency(12_000)

I get a rectangle wave (duty about 70%) at 12KHz...

If I increase the pwm_set_frequency further, I get same 12KHz but higher 
duty...

If I do
pwm_set_frequency(5_000)... I get no signal!

any ideas?

many thanks

Thomas

include 16f690 -- target PICmicro
--
-- This program uses the internal oscillator at 8 MHz
pragma target clock 8_000_000 -- oscillator frequency
-- configuration memory settings (fuses)
pragma target OSC INTOSC_NOCLKOUT -- internal oscillator
pragma target WDT disabled -- no watchdog
pragma target MCLR external -- reset externally

--
enable_digital_io() -- make all pins digital I/O
--
OSCCON_IRCF = 0b111 -- set internal oscillator for 8 MHz

-- Configure PWM
pin_ccp1_direction = output
include pwm_hardware
pwm_max_resolution(1)
pwm1_on()
pwm_set_frequency(5000)
pwm1_set_dutycycle_highres(500)

forever loop

end loop

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/jallib/-/1Lb7Ni0RM3EJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to