Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

PWM channel

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
wielklem

Bascom Member



Joined: 20 Nov 2008
Posts: 47
Location: the Netherlands

blank.gif
PostPosted: Wed Jun 23, 2021 11:08 am    Post subject: PWM channel Reply with quote

I've been out of Basom for several years but just started it again.
As it seems I have a small issue with a specific PWM channel (Pin B4) that I'm trying to use.

Code:
Config Timer1 = Pwm , Pwm = 8, Compare A Pwm = Clear Up , Compare B Pwm = Clear Up, Compare C Pwm = Clear Up , Prescale = 1

 compare0 = 128                                     'B4
 Compare1a = 255                                    'B5
 Compare1b = 128                                    'B6
 Compare1c = 16                                     'B7
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'from the .dat file
'Timer config: ATmega128
'[TIMER]
'COMPARE=9
'COMPARE1=COMPARE,PORTB.4
'COMPARE2=COMPARE0,PORTB.4
'COMPARE3=COMPARE1A,PORTB.5
'COMPARE4=COMPARE1B,PORTB.6
'COMPARE5=COMPARE1C,PORTB.7
'COMPARE6=COMPARE2,PORTB.7
'COMPARE7=COMPARE3A,PORTE.3
'COMPARE8=COMPARE3B,PORTE.4
'COMPARE9=COMPARE3C,PORTE.5
'
''''''''''''''''''


Any suggestions?


(BASCOM-AVR version : 2.0.8.3 )
Back to top
View user's profile
wielklem

Bascom Member



Joined: 20 Nov 2008
Posts: 47
Location: the Netherlands

blank.gif
PostPosted: Wed Jun 23, 2021 12:13 pm    Post subject: Reply with quote

I missread the datasheet, B4 is not linked to Timer 1, but Timer 0.
Adding the timer 0 config helps a lot (stupid Brick wall )
Code:

Config Timer0 = Pwm , Prescale = 1 , Compare Pwm = Clear Up , Pwm = On
 
Brick wall Brick wall Brick wall
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Wed Jun 23, 2021 2:33 pm    Post subject: Reply with quote

at least you read the datasheet and find it yourselves Very Happy
_________________
Mark
Back to top
View user's profile Visit poster's website
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Wed Jun 23, 2021 5:49 pm    Post subject: Reply with quote

.
This is also easy to check .....

Back to top
View user's profile
wielklem

Bascom Member



Joined: 20 Nov 2008
Posts: 47
Location: the Netherlands

blank.gif
PostPosted: Wed Jun 23, 2021 10:09 pm    Post subject: Reply with quote

like I've wrote; I've been out of basom for some years..
and indeed, reading helps Rolling Eyes
thanks for the hint on the pinout, can help Embarassed

best,
W
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum