Pulsein problem

Sym-1

New Member
Using an 08M, I'm trying to count pulses on two inputs, and stop a pwmout if either goes out of a range.

To achive the required pwmout frequency, I have dropped the clock speed to 1Mhz, using poke $8f, %01000000.

The problem is, at 1Mhz, if a pulsein times out, the program seems to crash.

At normal 4Mhz speed, it runs ok.
 

Technical

Technical Support
Staff member
The PIC has an internal watchdog which resets the chip after 2.3 seconds of inactivity.

This does not occur with a pulsin timeout at the correct 4MHz, as that is 0.65 second maximum. However at a 'hacked' speed of 1MHz your maximum pulsin is 2.6 seconds, hence the reason the chip is resetting.

So you can't use pulsin like this at 1MHz.
 

hippy

Ex-Staff (retired)
Do a Forum search as there is another way to reduce the PWM frequency and stay operating at 4MHz or 8MHz. It involves poking the PWM pre-scaler but I cannot recall the details.
 
Top