BasicMicroUK - Forums

MBasic pauseus
Page 1 of 1

Author:  wizard1 [ Wed May 26, 2010 9:41 pm ]
Post subject:  MBasic pauseus

I've been happy with he new MBasic release until I tried to use PAUSEUS. It seems that the shortest pulse I can generate is 300 uS. I've used pauseus many times in my 16F877 days. Now that I've moved to the new release and am programming 16F887's, pauseus doesn't behave like it used to.
This also applies to pulsout. I really need to make 5 uS pulses.
Does anyone know about this? Does anyone care anymore?

Author:  Acidtech [ Wed May 26, 2010 10:57 pm ]
Post subject:  Re: MBasic pauseus

5us pulses are going to be tough. You can try using pauseclk but I think the minimum time is still going to be longer than that. To make shorter pulse you may need to use inline asm. Do you need just 5us pulses or do you need adjustable lengths down to 5us?

Author:  wizard1 [ Thu May 27, 2010 10:00 pm ]
Post subject:  Re: MBasic pauseus

Thanks for the quick reply, Nathan.
I'm using the internal 8 MHz clock in the 16F887 and I had foolishly expected shorter pulses. I now recall that the last time I produced short pulses was with an 877 running 20 MHz. I needed the clock pins on the 887 for I/O and hence I'm stuck with the 8 MHz internal clock.

When I do this:
@high b0
@low b0

I get a 4 us pulse which is just fine for my pulse width.
If I do this:

@high b0
pauseus 5
@low b0
I get a 130 us pulse which indicates that that is the shortest pause I can get. I may be able to squeek through with this. I need to ramp the pulse repitition rate of the 4 us pulse from 1 kHz to 10 Khz.

Any ideas?

Author:  Acidtech [ Fri May 28, 2010 2:42 am ]
Post subject:  Re: MBasic pauseus

@high pin and @low pin are macros which use only a couple instruction cycles. Pauseus is a command which has entry code(approx 30 instruction cycles per token). Then the entry to the pause us command itself which is hard to calculate but is around 45 instruction cycles. You may want to try pauseclk for a shorter minimum time(it's a simpler command) but you won't be able to get as low as you are looking for I don't think, with basic commands.

There are macro commands for delays. They require constant arguments just like the @high and @low macros but can get you very short delays(down to 1us for @USDELAY).

@USDELAY cycles
@MSDELAY cycles

Author:  wizard1 [ Fri May 28, 2010 5:44 pm ]
Post subject:  Re: MBasic pauseus

Thanks Nathan.
I have compiled a small list of undocumented commands over the many years that I've been using MBasic. As far as I know, there has never been a list published.
I didn't know about:

@USDELAY cycles
@MSDELAY cycles

This is just what I need.

I sure wish I could search the archives of the old MBasic forum. I continued to get good info from it. Any chance the old forum could be reinstated?

BTW, the new MBasic Pro rev doesn't program 12c671 anymore. I have to switch back to the old rev to program them. Too bad.

Thanks for being here for me!

Author:  Acidtech [ Thu Jun 03, 2010 2:31 am ]
Post subject:  Re: MBasic pauseus

Hmm, you should be able to put the 12C671 in the device ini for mbasic to get it back in. We didn't drop any support for older processors with that new release so it must have gotten accidentally removed.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group