Problem with time delay

Status
Not open for further replies.

Bottna

New Member
Hello!
My namn is Evald,and I am doing a project where I need time delay in µS.
I use mikrobasic.I have Velleman K8048 PIC programmer board. I uses a PIC16F628,and
4MHz timebace.I have a problem:When i run the time delay in ms,it works OK.
I see a small text "Time-in-ms:Word".When I try to run in µs,it does not work.
a text like "Time-in-µs:Word"can i not see.
Her is a simplified code:

Main:
TrisA=1
TrisB=0
While (1)
Cmcon =7
'********************
If (portA.0=1)
Then portB.0=1
Delay_ms(100)
PortB.0=0
Delay_ms(150)
'*******************
End if
Wend
End.

Now,is the time delay in ms.if I change to µs,so it works not.
Maybe not the PIC rght configurerad,or is not right with variables or constants.
I do not know much about programming,so Ineed help of someone who is good at this.
Evald
 
Are you allowed to use uS in the delay command?, at 4MHz clock sped the instruction time is at least 1uS, so you can't have 1uS resolution in a BASIC instruction (and struggle in assembler for short ones).
 
The # button is used to post code and keep the formatting. Please use it.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…