Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 02:47 20 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Missing Something Simple(PicoMite)

Author Message
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 735
Posted: 10:53pm 04 Dec 2021
Copy link to clipboard 
Print this post

SETPIN pin, PWMnx Allocate pin to PWMnx
'n' is the PWM number (0 to 7) and 'x' and is the channel (A or B)
The setpin can be changed until the PWM command is issued. At that point
the pin becomes locked to PWM until PWMn,OFF is issued.

PWM channel, frequency,
[dutyA] [,dutyB]
PWM channel, OFF
There are 8 separate PWM frequencies available (channels 0 to 7) and up to
16 outputs with individually controlled duty cycle. You can output on either
PWMnA or PWMnB or both for each channel - no restriction.
Minimum frequency is 15Hz. Maximum speed is OPTION CPUSPEED/4
At very fast speeds the duty cycles will be increasingly limited

When I :

SetPin gp14,pwm7a
PWM 7,1000,50,50

I get :

[2] PWM 7,1000,50,50
Error : Pin not set for PWM
>

????
my site
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1116
Posted: 02:43am 05 Dec 2021
Copy link to clipboard 
Print this post

@hitsware2

You are setting gp14 for use as PWM7a, yet in your pwm line, you try to set both the A channel and the B channel to 50 percent duty cycle but you haven't defined which pin to use for channel B.

If you are not using pin 20 (gp15) for anything else, adding the line SETPIN GP15,PWM7B should fix the problem or loose the second 50 in your PWM line.

Cheers,
Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2832
Posted: 02:48am 05 Dec 2021
Copy link to clipboard 
Print this post

From Picomite doc a28

"SETPIN 1,PWM0A    'Provisionally allocate pin 1 (GP0) to PWM0A
SETPIN 2,PWM0B    'Provisionally allocate pin 2 (GP1) tp PWM0B
PWM 0,1000,33,67  'Frequency is 1kHz for PWM0x, PWM0A is 33%, PWM0B is 67%
                 'The pins are now locked to PWM usage until PWM 0,OFF
PWM 0,OFF         'PWM0A and PWM0B are both off and the pins are released"

Could it be case sensitive?
I don't yet have one to try it.

Cross post . Ignore this.
Edited 2021-12-05 12:50 by phil99
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 735
Posted: 07:50pm 05 Dec 2021
Copy link to clipboard 
Print this post

  panky said  @hitsware2

You are setting gp14 for use as PWM7a, yet in your pwm line, you try to set both the A channel and the B channel to 50 percent duty cycle but you haven't defined which pin to use for channel B.

If you are not using pin 20 (gp15) for anything else, adding the line SETPIN GP15,PWM7B should fix the problem or loose the second 50 in your PWM line.

Cheers,
Doug.

That did it ....  
Thank You !
my site
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025