Hi Hans,

I fixed the problem. There where actually two problems:

  1.  The PIC you are using has 3 prescaler bits instead of 2. The frequency 
would then not be correct.
  2.  The PIC you are using has a separate clock register for Timer 2. The 
default of that register is that it does not use Fosc/4 as input and because of 
that Timer 2 was not running.

Attached the update of the files. Please put them in your directory for 
testing. I also removed the deprecated functions from pwm3.jal and pwm4.jal 
since sufficient time has passed for JAL users not to use deprecated functions. 
It makes the code cleaner.

It works with your program but please remove the statement CCP1CON = TRUE from 
your program. It is not needed. I attached the version of your program again 
but changed the clock frequency to 32 MHz. The program also works with 4 MHz as 
in your original program. I also changed the program a bit. When the brightness 
of one LED increases, the other one decreases and the other way around. I 
changed it so that you can see that both LEDs work independently.

Let me know if it also works for you. If so I will upload the changed files to 
Jallib.

Thanks.

Kind regards,

Rob

________________________________
Van: [email protected] <[email protected]> namens hans 
<[email protected]>
Verzonden: vrijdag 26 augustus 2022 09:11
Aan: jallib <[email protected]>
Onderwerp: Re: [jallib] !6F15324 PWM RC5 and RC3

Hi Rob
morning test. Suddenly doesn't work anymore. Scoop doesn't give a signal either.
  Blink a led on both outputs C3 and C5 tested and freq to 16 (oB101) all works 
well.

Op donderdag 25 augustus 2022 om 22:20:49 UTC+2 schreef hans:
Hi Rob,
Hi Rob,
compiled and loaded with Pckit. Okay. Put on test board, leds on C3 and C5. 33K 
on mclr. LVP off. Both leds  go on and off but no light variation.
attached used program

Op donderdag 25 augustus 2022 om 20:55:40 UTC+2 schreef hans:
Hi Rob,
I put the file I showed yesterday in a separate folder. Add the three files you 
posted. When I compile now I don't get any errors anymore. I can see that he 
uses the common, but I don't know which of the other two. I'm going to test the 
case tomorrow to see if it works.
thanks again
regards
Hans

Op donderdag 25 augustus 2022 om 19:13:07 UTC+2 schreef [email protected]:
Hi Hans,

You discovered a limitation in some of the PWM libraries. For newer PICs some 
things have changed.

I modified 3 libraries to get it compiling again using your program but did not 
test this, see attachement.

Can you include these libraries in the same directory as your main program, 
test it and see if it works?

I can test it later this weekend but if you have tested it and it works I can 
skip that. If all is OK I will upload them the Jallib.

Thanks.

Kind regards,

Rob

________________________________
Van: [email protected] <[email protected]> namens hans 
<[email protected]>
Verzonden: woensdag 24 augustus 2022 20:34
Aan: jallib <[email protected]>
Onderwerp: Re: [jallib] !6F15324 PWM RC5 and RC3

hello Rob,,
Have tried  long time but many( 23) errors. To much for this old chap.
regards
Hans

Op dinsdag 23 augustus 2022 om 19:10:00 UTC+2 schreef [email protected]:
Hi Hans,

I did not see a sample file using two PWM's. I assume you can just include two 
PWM libraries and give it a try.

Note that for this specific PIC you can use PWM3, PWM4, PWM5 and PWM6 since for 
this PIC they start at 3.

I recently added libraries for PWM5 and PWM6 and sample programs for that.

As a test I of your challenge I combined the two pwm's from one of the sample 
files by just copying the lines of pwm5 and change them into pwm6 so the 
behaviour for both leds is the same, see attached file.

The compiler finds it OK but you need to test if it works for you (I did not 
test this) 🙂.

Kind regards,

Rob



________________________________
Van: [email protected] <[email protected]> namens hans 
<[email protected]>
Verzonden: dinsdag 23 augustus 2022 13:57
Aan: jallib <[email protected]>
Onderwerp: [jallib] !6F15324 PWM RC5 and RC3

Hello all.
I am looking for an example to use the 16F15324 for two PWM motor dirver 
outputs.
Is there any?
regards
Hans

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/5863d968-50c5-4e84-97d9-75ea6a9b41d0n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/5863d968-50c5-4e84-97d9-75ea6a9b41d0n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/9cd3c949-d591-450f-b607-a1b070a9930bn%40googlegroups.com<https://groups.google.com/d/msgid/jallib/9cd3c949-d591-450f-b607-a1b070a9930bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/fbb5ca2e-4790-4074-8b95-94650b5fd140n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/fbb5ca2e-4790-4074-8b95-94650b5fd140n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/GVXP195MB163763D8DC3443FEEB415F34E6749%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM.

Attachment: 16f15324_pwm_test3.jal
Description: 16f15324_pwm_test3.jal

Attachment: pwm_common.jal
Description: pwm_common.jal

Attachment: pwm_pwm3.jal
Description: pwm_pwm3.jal

Attachment: pwm_pwm4.jal
Description: pwm_pwm4.jal

Reply via email to