Shop OBEX P1 Docs P2 Docs Learn Events
Long..long time user of pbasic..very new to propbasic — Parallax Forums

Long..long time user of pbasic..very new to propbasic

dennodenno Posts: 223
edited 2018-08-12 07:10 in Propeller 1
I keep getting and error message in the following code: And, Bean...what is the latest propbasic version, I should be using?

The error code is:



PropBasic Version 00.01.44 Jul 13, 2014
Finished Compile. 37 Lines Read, 92 Lines Generated, 0 Warnings, 0 Errors.

Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
Compiled for i386 Win32 at 08:17:48 on 2009/07/20
Loading Object SIMPLE_BLINK_LED
Loading Object flash_16_LED.spin

flash_16_LED.spin(8,38) Error : Unresolved Symbol - __InitDi

DEVICE P8X32A, XTAL1, PLL16X
XIN 5_000_000
flash_16_LED  task
flash_17_LED  task
flash_18_LED  task

LED_16 pin 16 output
LED_17 pin 17 output
LED_18 PIN 18 OUTPUT

PROGRAM Start
Start:
 COGINIT Flash_16_LED, 2 ' Start task in COG 2
 COGINIT Flash_17_LED, 3
 COGINIT Flash_18_LED, 4

TASK Flash_16_LED
 LOW LED_16 
 DO
  TOGGLE LED_16
  PAUSE 100
 LOOP

TASK Flash_17_LED
 LOW LED_17
 DO
 TOGGLE LED_17
 PAUSE 100
 LOOP

TASK Flash_18_LED
 LOW LED_18
 DO
 TOGGLE LED_18
 PAUSE 100
 LOOP



END

Comments

  • As of today's date, the latest PropBASIC version is 1.48

    You will find it attached to the first post in this thread:
    http://forums.parallax.com/discussion/168744/download-propbasic-version-1-48-aug-9-2018-here

  • I could verify this issue.

    When compiling, the generated spin file for each task does not include long definition for __InitDirA.
    (main .spin does, but not the tasks)

    @Bean @Mickster Sorry to tag you, but any ideas on what to try? I'm going to grab an older propbasic.exe to test in a moment.


    Compiled TASK file
    PUB Init(pv_DataStart, pv_VP_Watch)                         
      _Fixup(pv_DataStart, pv_VP_Watch)                         
      Return ((pv_DataStart >> 2) << 18) + ((@__INIT >> 2) << 4)
                                                                
    DAT                                                         
      ORG 0                                                     
    __INIT                                                      
    __RAM                                                       
                      mov           dira,__InitDirA             
                      mov           outa,__InitOutA             
    
                      or            dira,LED_16                  'LOW LED_16
                      andn          outa,LED_16                 
    
    __DO_1                                                       'DO
    
                      or            dira,LED_16                  'TOGGLE LED_16
                      xor           outa,LED_16                 
    
                      mov           __temp1,#100                 'PAUSE 100
                      call          #_PAUSE                     
    
                      jmp           #__DO_1                      'LOOP
    __LOOP_1
    

    Compiled MAIN file
    ''  *** COMPILED WITH PropBasic VERSION 00.01.48  Aug 9, 2018 ***
    
    
    CON                                                          'DEVICE P8X32A, XTAL1, PLL16X
      _ClkMode = XTAL1 + PLL16X                                 
    
      _XInFreq = 5000000                                         'XIN 5_000_000
    
    OBJ flash_16_LED: "flash_16_LED.spin"                        'flash_16_LED task
    
    OBJ flash_17_LED: "flash_17_LED.spin"                        'flash_17_LED task
    
    OBJ flash_18_LED: "flash_18_LED.spin"                        'flash_18_LED task
    
    
    ' LED_16 pin 16 output                                       'LED_16 pin 16 output
    
    ' LED_17 pin 17 output                                       'LED_17 pin 17 output
    
    ' LED_18 PIN 18 OUTPUT                                       'LED_18 PIN 18 OUTPUT
    
    
    PUB __Program | __VarsPtr                                    'PROGRAM Start
      __VarsPtr := 0                                            
      flash_16_LED_COG:=flash_16_LED.Init(@__DataStart, 0)      
      flash_17_LED_COG:=flash_17_LED.Init(@__DataStart, 0)      
      flash_18_LED_COG:=flash_18_LED.Init(@__DataStart, 0)      
      CogInit(0, @__Init, __VarsPtr)                            
                                                                
    DAT                                                         
                      org           0                           
    __Init                                                      
    __RAM                                                       
                      mov           dira,__InitDirA             
                      mov           outa,__InitOutA             
                      jmp           #Start                      
    
    Start                                                        'Start:
    
                      mov           __temp1,Flash_16_LED_COG     'COGINIT Flash_16_LED, 2 ' Start task in COG 2
                      add           __temp1,#2                  
                      coginit       __temp1                     
    
                      mov           __temp1,Flash_17_LED_COG     'COGINIT Flash_17_LED, 3
                      add           __temp1,#3                  
                      coginit       __temp1                     
    
                      mov           __temp1,Flash_18_LED_COG     'COGINIT Flash_18_LED, 4
                      add           __temp1,#4                  
                      coginit       __temp1                     
    
    
    '**********************************************************************
    __InitDirA       LONG %00000000_00000111_00000000_00000000
    __InitOutA       LONG %00000000_00000000_00000000_00000000
    LED_16           LONG 1 << 16
    LED_17           LONG 1 << 17
    LED_18           LONG 1 << 18
    _FREQ            LONG 80000000
    
    ____STRING_adr   LONG 0
    __clkfreq_adr    LONG 0
    flash_16_LED_COG LONG 0-0
    flash_17_LED_COG LONG 0-0
    flash_18_LED_COG LONG 0-0
    
    __temp1          RES 1
    __temp2          RES 1
    __temp3          RES 1
    __remainder
    __temp4          RES 1
    __temp5          RES 1
    __param1         RES 1
    __param2         RES 1
    __param3         RES 1
    __param4         RES 1
    __paramcnt       RES 1
    
    FIT 492
    
    CON
      LSBFIRST                         = 0
      MSBFIRST                         = 1
      MSBPRE                           = 0
      LSBPRE                           = 1
      MSBPOST                          = 2
      LSBPOST                          = 3
    
    ' TASK Flash_16_LED                                          'TASK Flash_16_LED
    
  • @denno

    When posting code, could you use the code tags please?
    They make things easier to read, and easier to copy paste your code for testing.

    I've edited you first post to include the tags, so you can see how they work.

    To get the tags, click the C on the post top-bar, or manually type [ code ][ /code ] around your code.


    ps. Should be NO spaces inside those square brackets....
  • Update...

    PropBasic 1.44 is the oldest I could find, and that fails the same way. (OP was using that version too!)

    I tried a simpler code snippet, taken from PropBasic.pdf, and that has the same issue.

    Anyone got an older PropBasic executable to try?
    DEVICE P8X32A
    XIN 5_000_000
    
    FlashLED TASK
    PROGRAM START
    Start:
    COGINIT FlashLED, 1 ' Start task in COG 1
    PAUSE 10_000 ' Let task run for 10 seconds
    COGSTOP 1 ' Stop the task
    END
    
    TASK FlashLED
    LED PIN 16 LOW
    DO
    TOGGLE LED
    PAUSE 100
    LOOP
    TASK END
    
  • Thanks Publison.

    Same error with version 1-42.

    Might be something up with the code snippet... Not seeing it right now, but perhaps I'll take a look again later.

  • pmrobertpmrobert Posts: 673
    edited 2018-08-12 14:27
    Might be something up with the code snippet... Not seeing it right now, but perhaps I'll take a look again later.
    Yes! There's a syntax error; "TASK END" should be "ENDTASK". The COGINIT snippet in the PB manual, p44, is missing the ENDTASK - that's probably the genesis of this simple yet confusing issue.

    -Mike R...
  • Good catch! That was it! All compiles great now.

    @denno code also had END in the wrong place- here's the edited code with both fixes:
    DEVICE P8X32A, XTAL1, PLL16X
    XIN 5_000_000
    flash_16_LED task
    flash_17_LED task
    flash_18_LED task
    
    LED_16 pin 16 output
    LED_17 pin 17 output
    LED_18 PIN 18 OUTPUT
    
    PROGRAM Start
    Start:
    COGINIT Flash_16_LED, 2 ' Start task in COG 2
    COGINIT Flash_17_LED, 3
    COGINIT Flash_18_LED, 4
    END
    
    TASK Flash_16_LED
    LOW LED_16
    DO
    TOGGLE LED_16
    PAUSE 100
    LOOP
    ENDTASK
    
    TASK Flash_17_LED
    LOW LED_17
    DO
    TOGGLE LED_17
    PAUSE 100
    LOOP
    ENDTASK
    
    TASK Flash_18_LED
    LOW LED_18
    DO
    TOGGLE LED_18
    PAUSE 100
    LOOP
    ENDTASK
    
    
    
  • @Bean

    Updated documents files now on Github: https://github.com/parallaxinc/PropBASIC/tree/master/doc
  • pmrobert wrote: »
    Might be something up with the code snippet... Not seeing it right now, but perhaps I'll take a look again later.
    Yes! There's a syntax error; "TASK END" should be "ENDTASK". The COGINIT snippet in the PB manual, p44, is missing the ENDTASK - that's probably the genesis of this simple yet confusing issue.

    -Mike R...

    Good call! An extra set of eyes always helps.
  • Thank you to all, and I did have END in the wrong place and I had TASK END, instead of ENDTASK. One other problem, is I still cannot open ZIP files to get the latest 1.48 PropellerIDE with this Windows 7. Someone sent me the application with a .TXT extention, and said to change it to an .exe file, but that did not work either...any suggestions?
  • Sounds like file extensions are hidden in windows folder settings.

    Make them un-hidden, then renaming files will be easier.

    Google "hide file extensions for known file types"

    Another option is download the .exe direct from Github. I posted the link in your other thread.

Sign In or Register to comment.