the zip contains images but it is unclear which one is from which test.
you have made a number of tests but you did not once produced code i asked for.
in your original posted program you had :
Locate 1 , 1 : Lcd "IC " ; bin(icr1)
Locate 2 , 1 : Lcd "IC " ; bin(icr1)
please replace them with
Locate 1 , 1 : Lcd "IC " ; bin(dummy)
Locate 2 , 1 : Lcd "IC " ; bin(dummy)
and let me know the result.
then, why using pwm1a ? what good is it to show ?
a test like :
Locate 1 , 1 : Lcd "1: " ; Icr1
Locate 2 , 1 : Lcd "2: " ; Icr1
Locate 3 , 1 : Lcd "3: " ; Bin(icr1)
Locate 4 , 1 : Lcd "4: " ; Bin(icr1)
and :
Locate 1 , 1 : Lcd "1: " ; hex(Icr1)
Locate 2 , 1 : Lcd "2: " ; hex(Icr1)
Locate 3 , 1 : Lcd "3: " ; Bin(icr1)
Locate 4 , 1 : Lcd "4: " ; Bin(icr1)
can better narrow down the problem.
and better : instead of using ICR1 which is a register which can change, you can best use a variable. assign a dummy variable with ICR1 once, and then display the values like you did.
if that gives different results it sure is a software problem.
i will check your code later. but the reason is either that bin() gives a wrong result or that icr1 changes after the first read. since the sim produced the same values, i suspect the problem is the last.
but the test above will clearly demonstrate that.
↧