While working on config Timer1 for different PWM-modes I took a look at register settings in binary format.
The (condesed) program show two differnt values for variable ICR1 *at the verry first* display.
First line reads: 0000010000000000 - > wrong!
Second line reads: 0001000000000000 - > ok
for the same variable.
Second and all other displays are correct.
I'm confused :o
MHz
'-------------------------------------------------
$regfile = "m328pdef.dat".
$crystal = 8000000 '
Config Lcdpin = Pin , Db4 = Portc.5 , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0 , E = Portc.4 , Rs = Portc.3
Config Lcd = 20 * 4
Dim Dummy As Word
cls:wait 1
Icr1 = 4096
Dummy = Icr1
Shift Dummy , Right , 2
Pwm1a = Dummy
do
Cls
Locate 1 , 1 : Lcd "IC " ; bin(icr1)
Locate 2 , 1 : Lcd "IC " ; bin(icr1)
Locate 3 , 1 : Lcd "pw " ; bin(pwm1a)
Locate 4 , 1 : Lcd "co " ; bin(Compare1a)
wait 4
loop
'-----------------------------------------------------------------------
[b:44df7a2f22][color=red:44df7a2f22](BASCOM-AVR version : 2.0.7.6 )[/b:44df7a2f22][/color:44df7a2f22]
↧