Hi,
You should be able to generate pulses accurate to about +/-1% with for example
PULSOUT pin , 10 for 100us, etc. (i.e. in increments of 10us). BUT, the gap
between pulses (from consecutive instructions) will be about 700 microseconds because of the decode/execution time of the interpreted Basic language. You could improve this by using a
SETFREQ M32 and then
PULSOUT pin , 80 for 100us, etc.. which will reduce the gap between pulses to about 90 us (for consecutive instructions).
If you want to control "High" and "Low" pulse periods at the same time then you can use PAUSEUS 1 which executes in a very similar time to PULSOUT pin , 1. Thus you could try :
SETFREQ M32 : HIGH pin : PAUSEUS 1 : LOW pin : PAUSEUS 81 : HIGH pin , etc.. That will probably give a High pulse of slightly over 100 us and a Low period which is about 100 us longer than the pulse (adjustable in 1.25 us increments). However, any program loops (e.g. FOR .... NEXT , DO .... LOOP UNTIL .. , etc.) will add their own delays of around 2 ms at 4 MHz (or a simple GOTO .. adds around 1 ms).
Alternatively, for an accurate, repeating pulse waveform you could use the (H)PWMOUT commands, for example
PWMOUT pin , 49 , 100 should give quite accurate 100 us pulses spaced by 100 us. Then the pulse widths could be updated "on the fly" by issuing a new command such as PWMOUT pin , 99 , 200 or sometimes better with PWMDUTY ... and again you can increase/decrease the resolution with SETFREQ .. command and/or the PWMDIVn constants.
Note that most of these commands (except the PWMDIVn qualifier) can use PICaxe variables, so commands such as
PAUSEUS w1 or even
PWMOUT b0 , b1 , w1 can be valid commands (provided that the variables are set correctly).
Cheers, Alan.