Shop OBEX P1 Docs P2 Docs Learn Events
PropBASIC — Parallax Forums

PropBASIC

caskazcaskaz Posts: 957
edited 2010-03-15 10:26 in Propeller 1
Hi, Guys.

I installed PropBasic(bst-0.19.1.exe & PropBasic-bst-00.00.87-47.exe)
I made sample(LED.pbas) But it don't work

OnTime CON 250
OffTime CON 750
IsOn CON 1
IsOff CON 0
LED PIN 0 LOW
idx VAR  LONG
DELAY_MS SUB 1

PROGRAM Start
Start:
 FOR idx = 1 to 3
   LED = IsOn
   DELAY_MS OnTime  <-- (36.33)
   LED = IsOff
   DELAY_MS OffTime  <-- (41.33)
 NEXT
 DELAY_MS 1_000  <-- (49.33)
 GOTO Start

SUB DELAY_MS
 PAUSE __param1
 ENDSUB




Compiling, there are errors.

LED (36.33)Error:Unresolved Symbol-__param1
LED (41.33)Error:Unresolved Symbol-__param1
LED (49.33)Error:Unresolved Symbol-__param1

How does it resolve?

Post Edited (caskaz) : 3/13/2010 5:22:57 AM GMT

Comments

  • Tony B.Tony B. Posts: 356
    edited 2010-03-13 04:27
    caskaz,

    I have attached a new code file. I believe this is what you are trying to accomplish. You can compare it to your code and see the changes. I tested it on my Propeller Professional Development Board, but it should work on any board or Propeller setup running on a 5mhz crystal

    In future post it would be helpful to post what your setup is and attach your code as a file so others can download and easily look at it.

    Hope this help gets you moving forward.

    Tony

    Post Edited (Tony B.) : 3/13/2010 4:37:34 AM GMT
  • caskazcaskaz Posts: 957
    edited 2010-03-13 05:00
    Thank you.

    I forgot Device directive.
    Although I had checked my code for several times....
  • caskazcaskaz Posts: 957
    edited 2010-03-13 06:00
    I have ona more question.
    Although delta doesn't set initial value, it works.
    PropBASIC set initial data at VAR directive?

    DEVICE P8X32A,XTAL1,PLL16X
    XIN 5_000_000
    
    target VAR LONG
    delta VAR LONG
    LED PIN 0 HIGH
    
    PROGRAM Start
    Start:
    RDLONG 0,delta
    delta = delta >>1
    taget = cnt + delta
    DO
      TOGGLE LED
      WAITCNT target, delta
    LOOP
    
    
  • BeanBean Posts: 8,129
    edited 2010-03-13 10:36
    The first thing you do is "RDLONG 0, delta" which will set "delta" to the current clock frequency.

    Everything looks fine in your code to me. Why wouldn't it work ?

    PropBASIC does NOT set any initial value to VARs unless you specify. Like "delta VAR LONG = 0". Otherwise it will have whatever value happens to be in memory at the time.

    Thanks for giving PropBASIC a try, it looks like you are getting the hang of it already.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    ·
  • caskazcaskaz Posts: 957
    edited 2010-03-13 11:27
    Bean.
    Thank you for your reply.

    PropBASIC code fine works.
    I wonder statement of "RDLONG 0, delta".
    Although I read "PropBASIC_Syntax_Guide_0x13", there was not such a thing.(set "delta" to the current clock frequency)

    And there is words of viewing a 1-for-1 (from BASIC to Asm code) on Section"About PropBASIC", How can asembler codes watch?
  • Gerry KeelyGerry Keely Posts: 75
    edited 2010-03-15 10:26
    caskaz

    RDLONG 0, delta reads the first long in hub memery into delta.if you look at the spin compiler output you will see this.

    For example assuming the clock is 80_000_000MHz, in hex this is 04-C4-B4-00,these should be the values stored in the first 4 hub mem locations



    Gerry

    Post Edited (Gerry Keely) : 3/15/2010 10:31:35 AM GMT
Sign In or Register to comment.