I believe that the Picaxe 08M2 is using the PIC12F1823. I see that it has three timers timer0, timer1, timer2, two 8 bits timers and one 16 bit. Searching the forum I see various threads which utilize timer1, via peekSFR and pokeSFR. I would like to try to use a timer to measure the time period of a pulse on an input pin, hopefully using an interrupt.
The Picaxe 08M2 is actually a Microchip 12F1840. IF we look at the description of pokesfr in manual2 it reads:
M2 parts:
As location can only take the value 0-255 the value for M2 locations taken from
the Microchip datasheet are created as follows:
Bit 7-5 Memory Bank $00-$07
Bit4-0 Addresses $0C to $1F on this bank
($00-$0B are invalid and cause instant reset)
This basically says that we can access memory banks 0-7 and then only register addresses between 0x0C and 0x1F.
Now look at the PIC12F1840 Datasheet (Table 3-3)
The Timer1 registers are in bank 0 - Good
Timer1 Register addresses are $16,$17,$18 and $19 - Good
PIR1 Register is bank0 Address 0x11 - Good
PIE1 Register is bank1 Address 0x11 - Good
However, (here comes the bad news)
The INTCON register is in Bank0 / Address
0x0B and is therefore made out-of-bounds by the Picaxe firmware. Attempting to access will cause an instant chip reset. This is necessary since the Picaxe firmware needs to exclusively manage all hardware interrupts in order to work. So you cannot manually enable or disable global interrupts with the GIE bit.
This all means that with POKESFR and PEEKSFR you can access the timer, stop and start it and read the values and even read and clear the T1IF flag bit and for the looks of it even enable the TMR1IE Bit. But again, you CANNOT enable or disable the Global interrupts vial INTCON.
Even if this all works I am not sure how you would manage the TMR1 hardware interrupt. Then consider the Picaxe overhead of approx 100 us to execute one command and move to the next. This seems to me to be an exercise in futility.
The good new is that Pulsein works well and has good accuracy and good resolution if the Picaxe is operating at 32MHz.
Perhaps tell folks WHY you want to do this and you might get better responses. Are you possibly wanting to make high resolution measurements of very short duration pulses ?