Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Simulator wait n and waitms n problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Unsupported versions
View previous topic :: View next topic  
Author Message
sidknox

Bascom Member



Joined: 30 Apr 2006
Posts: 29
Location: NorthEast Oklahoma USA

usa.gif
PostPosted: Sun Nov 12, 2017 12:41 am    Post subject: Simulator wait n and waitms n problem Reply with quote

I am unable to make either "wait n" or "waitms n" work in the simulator.
This simple code example shows the problem:

*********************************************************************************
'-----------[ Title ]----------------------------------------------------------
' Filename : Sim-Wait test.bas
' Purpose : testing wait and waitms in simulator
' Author : sid knox
' Date : 11 Nov 2017
' Compiler : BASCOM-AVR Rev. 2.0.7.8
' PC : Toshiba Satelite Pro, XP Pro SP3
'
'----------- [ Options/Compiler/Chip ] ------------------------------------------

$Regfile = "ATtiny2313.dat"
$Crystal = 1000000 'internal 8 MHz clock / 8
$hwstack = 32
$swstack = 32
$framesize = 32

$sim

'-------------------------------- [ Main] ------------------------------------------

print "start wait"

wait 3
'waitms 990

print "wait finished"

End

*********************************************************************************
When I click the Run button (F5), both the print statements print to the sim's Terminal with no delay from the
"start wait" to the "wait finished" . This happens whether I use "wait" or waitms".

I have read Help for the Sim, read Help for WAIT, and searched the forum with the search string:
simulator wait
and found nothin related to what I am seeing.
The attached jpg shows what files the compiler made.

_________________
SidK
Oklahoma
USA
Back to top
View user's profile
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1570
Location: Basel, Switzerland

switzerland.gif
PostPosted: Sun Nov 12, 2017 8:40 am    Post subject: Reply with quote

Hi,

Just remove the $sim command.

This tells the Compiler you want to run in the Simulator/which causes the Compiler to modify the code Abit (including removing delays).

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
sidknox

Bascom Member



Joined: 30 Apr 2006
Posts: 29
Location: NorthEast Oklahoma USA

usa.gif
PostPosted: Mon Nov 13, 2017 5:02 am    Post subject: Reply with quote

Hi Ian,
You obviously know your way around the Simulator, that fixed it.
The delay time now is a factor of about 6 longer than the time specified in the 'Wait n' statement but that is ok for what I am doing. If I need a more precise time I can just tweak n as desired.

I have another Sim question but I'll start another thread.
I thank you for your help.
Sid

_________________
SidK
Oklahoma
USA
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Unsupported versions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum