Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Hi N,What are you trying to read/write?, I presume you are aware it's a specific hardware function?, specifically for TMR1 - so you can read it as a single 16 bit read instead of two 8 bit reads. You have to configure a bit in TMR1 to enable it.
Hi J,I think what you saw is a function of Oshonsoft. Years ago, I tried in Assembly to write to TMR1L with multiple addwf's to see whether TMR1H would catch the overflow, and it didn't. Of course, you can write to both registers separately or threat them in the usual 8-bit H/L register way. I then tried counting down from TMR1L, and again, it did not automatically handle the borrow like TMR1 does when counting down.
If you decompile your code, I'll bet it's at least 4 lines of code: e.g., movlw high(1000), movwf TMR1H; movlw low(1000), movwf TMR1L. I agree with Nigel. It's a special function, and you cannot divert it to another use like you show. Of course, it is a 16-bit counter/timer when using the correct gate source.
Hi J,
I didn't consider Oshonsoft, only the D/S from where the section in #3 came from.
Here is the OSH ASM for that section:
TMR1HL = 0x03e8
MOVLW 0xE8
MOVWF TMR1L
MOVLW 0x03
MOVWF TMR1H
This shows in the Simulator TMR1 BYTEs, but from what you say this won't work.
If not, then following the RD16 section in the D/S, how do I implement it?
C
Check what code it's creating, see if it's like the assembler in the datasheet.Hi J and N,
I did read the D/S, but couldn't understand it, so I just pressed buttons, and saw that the Time went into the correct registers.
If it works, then is it ok?
C
Hi T,I think you're missing the point.
If you have the RD16 bit set then you have to read and write the TMR1L and TMR1H registers in a particular sequence (see posts #11 and #13).
If you use 'TMR1HL = 0x03e8' it doesn't use the correct sequence. That would be ok if you had RD16=0, but not with RD16=1. If the simulator seems to be showing it working then the simulator is wrong, and when you run it on real hardware it won't work the same.