| ??? 07/28/09 21:08 Read: times |
#167983 - Dec Responding to: ???'s previous message |
Maarten Brock said:
Steve,
Steve M. Taylor said:
XCH A,r0 ;Get r0
DEC A
JNZ nxtr1 ;Is it Zero ? Turn off the bit, else next bit
clr P2.0
nxtr1: XCH A,r0 ;PUT DECREMENTED register back !
Have you forgotten about DJNZ Rn? Or am I missing something? Maarten I was doing a DEC A and XCH it back. Yours is faster. Mines not not quite right is it ? I need a catch when the port is clear to not do anything, so noting that... ;mine might be
JNB P2.0,nxtr1 ; 2 cycles
XCH A,r0 ; 1 cycle
DEC A ; 1 cycle
JNZ nxtr1 ; 2 cycles
clr P2.0 ; 1 cycle
nxtr1: XCH A,r0 ; 1 cycle (total 8 cycles/channel)
;yours might be
JNB P2.0,nxtr1 ;2 cycles
DJNZ r0, nxtr1 ;2 cycles
CLR P2.0 ;1 cycle
nxtr1: JNB P2.1,nxtr2
DJNZ r1, nxtr2
CLR P2.0
nxtr2: JNB P2.1,nxtr3
Frankly, I'm so out of practice, I'd forgotten DJNZ ! Doooh. Steve |
| Topic | Author | Date |
| Simple PWM to drive led | 01/01/70 00:00 | |
| Loop lasts too long! | 01/01/70 00:00 | |
| I put the delay... | 01/01/70 00:00 | |
| Did you see? | 01/01/70 00:00 | |
| didnt noticed! | 01/01/70 00:00 | |
| Ok, try the following... | 01/01/70 00:00 | |
| the JMP | 01/01/70 00:00 | |
| I thought this was your intention... | 01/01/70 00:00 | |
| Another try | 01/01/70 00:00 | |
| is possible to filter the pwm output... | 01/01/70 00:00 | |
| PWM from a Timer interrupt? | 01/01/70 00:00 | |
| questions | 01/01/70 00:00 | |
| best code until now | 01/01/70 00:00 | |
| read replies | 01/01/70 00:00 | |
| will lower refresh rate | 01/01/70 00:00 | |
| Time to switch... | 01/01/70 00:00 | |
| Wrong. | 01/01/70 00:00 | |
| my code is doing what I want | 01/01/70 00:00 | |
| TIming | 01/01/70 00:00 | |
| FOR NOW!!!! | 01/01/70 00:00 | |
| The old story... | 01/01/70 00:00 | |
| DJNZ | 01/01/70 00:00 | |
| Dec | 01/01/70 00:00 | |
| Do nothing? | 01/01/70 00:00 | |
| Speed | 01/01/70 00:00 | |
| slowdown | 01/01/70 00:00 | |
| Chico | 01/01/70 00:00 | |
| Not yet... | 01/01/70 00:00 | |
good catch | 01/01/70 00:00 |



