Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic - how to use WAITCNT — Parallax Forums

PropBasic - how to use WAITCNT

camelot2camelot2 Posts: 54
edited 2010-10-06 11:16 in Propeller 1
hi, I am still a newbie to PropBasic and have a problem
trying to use the command WAITCNT. What I want to do is
use WAITCNT to make the program execution wait for 80nS
in several locations of the program as in the following.
Could someone please lead me to an example and/or some
clues as how to do this. thanks for your help - Dave

DEVICE P8X32A, XTAL1, PLL16X
XIN 6_250_000

value VAR LONG(150)
target VAR LONG
delta VAR LONG

PROGRAM Start

value(1) = ina
waitcnt target,delta 'wait for 80nS
value(2) = ina
waitcnt target,delta 'wait for 80nS
'
'
value(149) = ina
waitcnt target,delta 'wait for 80nS
value(150) = ina
waitcnt target,delta 'wait for 80nS


END

Comments

  • BeanBean Posts: 8,129
    edited 2010-10-06 08:37
    80nS is too short for WAITCNT, just use a couple NOP instructions.

    Bean
  • camelot2camelot2 Posts: 54
    edited 2010-10-06 08:50
    thanks for the reply Bean, if 80ns is too short then what
    is the minimum wait and how do I code it ?thanks again - Dave
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-10-06 11:16
    I think the minimum WAITCNT (in assembly, which PropBASIC gets converted to) is nine cycles. At 80MHz this would be 113ns.
Sign In or Register to comment.