vDelay_ms

Discuss about beta versions of mikroBasic
compiler.
Post Reply
Author
Message
Charlie
Posts: 2744
Joined: 01 Dec 2004 22:29

vDelay_ms

#1 Post by Charlie » 07 Sep 2006 13:06

In the following code the results are a little strange.It starts out working and then if I turn the pot to full counterclockwise position(Easypic3) portB freezes and hangs to the on position.Even if I turn the pot back to the full clockwise position.If I enable the WDT it helps,but the results are still not what I expect. Not a big deal. :)

Code: Select all

dim var as word


main:
  Adcon1 = $80
  trisA = 255
  trisB = 0

     var = Adc_Read(2)

       PortB = 255
       vdelay_ms(var)
       PortB = 0
       vdelay_ms(var)
       goto main
       
       end.
Regards Charlie M.

Sorcerer
Posts: 229
Joined: 14 Dec 2005 14:10
Location: Doncaster, UK
Contact:

#2 Post by Sorcerer » 07 Sep 2006 13:24

I remember it being mentioned somewhere that minimum value for vdelay_ms is 11.

Looking at the code it produces the first thing it does is subtract 10 from
the parameter passed to it.

If the value read from the adc is less than 11 then the delay will be about 65 seconds (65536 - value read from adc)

Charlie
Posts: 2744
Joined: 01 Dec 2004 22:29

#3 Post by Charlie » 07 Sep 2006 13:32

Hi Sorcerer,

Thanks .That explains a lot.I guess I should of read how the vdelay_ms worked. :oops:
Regards Charlie M.

Post Reply

Return to “mikroBasic Beta testing”