I don't think you will be able to generate 2 distinct tones. From the PBP manual:
Frequency is the desired frequency of the PWM signal. On devices
with 2 channels, the Frequency must be the same on both channels.
I don't think you will be able to generate 2 distinct tones. From the PBP manual:
Frequency is the desired frequency of the PWM signal. On devices
with 2 channels, the Frequency must be the same on both channels.
That's a very valid point, one that I totally missed when reading Jims initial post, sorry about that!
That limitation comes from the fact that the CCP module(s) are (historically) tied to the same timebase so they need to have the same output frequency. Thankfully things have changed over the years and the CCP modules on the 16F1938 can individually be assigned any of TMR2/TMR4/TMR6 as their timebase. It does however mean that HPWM is out (at least I Think it is) and you'll need to setup the CCP modules manually.
/Henrik.
So that means directly writing to the correct ports might do what I want? I didn't start testing yet. I did purchase an LED 3 channel 8-bit PWM driver to try (TLC59731DR). I thought it was SPI, but it isn't, and It also controls duty cycle. There are plenty of external devices available that look like they might work, but I'll wait until after I rule out the 16F1938 as an option.
Thanks
Well, not the ports but the registers for the CCP modules(s), yes. Two-three registers per module maby, so four to six lines of code to have both running. The "trick" is to figure out what to write to the registers, the datasheet is key.So that means directly writing to the correct ports might do what I want?
No, it's not SPI, more "like" async serial and yes the dutycycle of the fixed frequency output IS the only thing it controls - that's how it dims the LEDs.I did purchase an LED 3 channel 8-bit PWM driver to try (TLC59731DR). I thought it was SPI, but it isn't, and It also controls duty cycle.
It's not really clear what exactly you want to do. In the first post you mention generating two distinct tones but then you're talking about LED dimmers. Can you explain what you're trying to achieve?
Yes, Registers are what I meant. I just ordered a few PIC10F322 & 12F1840 chips (They are very small - 6 & 8 pin). I figure the best way to be sure I get the tones I want at a volume I expect would be to use one of these for each tone. One input pin to trigger, one output for the sound, and either two inputs to select 1 of 4 pre-set tones or one analog input to select a range of tones. the 6-pin SOT package wouldn't take up much board space and the price is right. I still plan on playing around with the CCP module of the 1938, but using a couple of these small chips seems to be the easiest way to go for this project.
I thank you for your help and will let you know the outcome of the testing.
Jim
16F876A has 2 independent pwm channels, and I'm using them just fine.
Bookmarks