Hi,
The toggle command first makes the pin an output, then it reads the state of the pin, then it inverts the state, then it writes the new state to the pin - takes time.
High/Low first makes the pin an outout then sets the pins state - takes a little less time.
You'll get more speed of you write to the pin directlyIf you can handle some jitter / discontinuity in the output then something likw this will give you even higher average frequency with the drawback that every 6th pulse will be "missing" due to the GOTO.Code:TRISO.0 = 0 'Make pin an output DoIt: GPIO.0 = 1 GPIO.0 = 0 Goto DoItAnother aproach would be to use the CCP module, though I'm not sure if the 10F series have that built in.Code:DoIt: GPIO.0 = 1 GPIO.0 = 0 GPIO.0 = 1 GPIO.0 = 0 GPIO.0 = 1 GPIO.0 = 0 GPIO.0 = 1 GPIO.0 = 0 GPIO.0 = 1 GPIO.0 = 0 Goto DoIt
Of course if all you need is stable 1MHz (or whatever that can be derived from the oscillator) signal then use clock-out option of the chips oscillator.
/Henrik.




Bookmarks