View previous topic :: View next topic |
Author |
Message |
sshorter
Joined: 07 Dec 2004 Posts: 12
|
Posted: Thu Dec 16, 2004 7:56 pm Post subject: More M128 PWM Problems (Questions about Config. Statements) |
|
|
I have a question regarding how BASCOM processes it Config statements.
I need to have the ability to change the configurations during the course of program execution. It appears that BASCOM reads the Config statments first before compiling the rest of the code. I observed this with two different Config. statements inside of two different If-Then statements. The values written to the registers were always the ones in the last Config. statement, even if the If-Then was not true.
Here's what I was trying to do.
If Current_Prescaler1 = 1 Then
'Print "8-Bit, 1:1 Prescale"
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear down , Compare B Pwm = Clear Down , Prescale = 1
End If
.
.
.
If Current_Prescaler1 = 2 Then
'Print "8-Bit, 1:8 Prescale"
'Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear down , Compare B Pwm = Clear Down , Prescale = 8
End If
In the above statements, if I change the resolution (8, 9, or 10) the PWM output changes accordingly. However, I cannot seem to change the prescale value.
I am not opposed to skipping the Config statements and writting to the registers directly, but I can't seem to find all that I need to get this to work. What registers are written to using these statements?
So far all I see are registers Tccr1A and Tccr1B. Any ideas?
Thanks in advance. |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Fri Dec 17, 2004 7:56 pm Post subject: |
|
|
Hi,
I'have been to the help and look at "config" then you have a list where you can see what it reconfigurable or not
Timer 1 is reconfigurable, so , I think you can use other prescaler adjustement ...(I hope so)
fortunaltly PWMa= nnn could be change without any PB
JP _________________ pleasure to learn, to teach, to create |
|
Back to top |
|
|
|
|
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
|
|