Shop OBEX P1 Docs P2 Docs Learn Events
Download PropBASIC here... 00.01.14 LAST VERSION FOR BST - Page 29 — Parallax Forums

Download PropBASIC here... 00.01.14 LAST VERSION FOR BST

1232425262729»

Comments

  • MicksterMickster Posts: 2,588
    edited 2013-08-27 02:39
    To a large extent, the onus is on PropBasic fans/programmers to make this compiler more popular. Spin is so convenient due to the OBEX. We need a LOT more PropBasic contributions.

    Regards,

    Mickster
  • BeanBean Posts: 8,129
    edited 2013-08-27 04:39
    Mickster wrote: »
    To a large extent, the onus is on PropBasic fans/programmers to make this compiler more popular. Spin is so convenient due to the OBEX. We need a LOT more PropBasic contributions.

    This is true. I just uploaded a Keyboard library http://obex.parallax.com/object/709 but many many more are needed.

    The ones I get the most requests for are SD Card and Floating Point Math if anyone wants to tackle either of those I'd be willing to help.

    Bean
  • andre.nieuwoudtandre.nieuwoudt Posts: 65
    edited 2013-09-23 14:23
    Hi Bean,

    I need to create an array dynamically during runtime, i.e. the dimension of the array is the result of a calculation, but I can't do that with "Hub_Array HUB WORD(Calculated_Variable)". However, addressing the Hub Ram directly is not a problem. So, instead of using an Array definition, I can write to and read from a range of addresses in the Hub Ram suitable for the size of the array I need, using a "base" address and offsets for each Array value. But the question is which part of the Hub Ram is safe to use without overwriting program code (most of my programs use LMM mode) or Hub Variables?

    I have been "poking" (who still remembers this Basic command?) around in the Hub Ram and it seems that program code and variables are loaded starting from address $0000 upwards. The propeller Datasheet says the following regarding Cog Ram: "When a cog is booted up, locations 0 ($000) through 495 ($1EF) are loaded sequentially from Main RAM / ROM .....", so I guess the Hub Ram is addressed in the same fashion?

    Which means, depending of the size of the LMM program + Variables, it should be safe to to use addresses at the upper end ($7FFF) of the Hub Ram?

    Regards
    Andre
  • andre.nieuwoudtandre.nieuwoudt Posts: 65
    edited 2013-09-23 14:55
    I forgot to mention regarding the question in my previous post: for those who need multi-dimensional arrays, I have developed a rather simple method of "storing" a multi-dimensional array as a single array. I have attached sample code for 2, 3 and 4-dimensional arrays as well as a spreadsheet that shows the math. As soon as I get the dynamic array code sorted, I'll post new sample programs.

    Regards
    Andre

    PS. I have modified the original TX_RX Library for generic SEROUT & SERIN usage so if you want to run my sample programs as is, you will need to use the attached TX_RX_LIB
  • andre.nieuwoudtandre.nieuwoudt Posts: 65
    edited 2013-09-23 15:18
    Here is an updated version of the multi-dimensional array spreadsheet attached in the previous post.
  • BeanBean Posts: 8,129
    edited 2013-09-23 15:43
    To my knowledge the HUB fills from low addresses, so using the upper addresses should be safe.

    Bean
  • andre.nieuwoudtandre.nieuwoudt Posts: 65
    edited 2013-09-23 23:59
    Yip, I did a few more tests and it is definitely filled from the low addresses.
  • andre.nieuwoudtandre.nieuwoudt Posts: 65
    edited 2014-04-02 15:04
    Hi Bean,

    I don't know if you are still working on PropBasic - there has been no posts for a while? Is there a new thread?

    In any case, I have come across something which worked prior to version 1.30, but does not seem to work anymore. It used to be possible to start a cog from within a task, but with version 1.30, for the sample code below, Task_2.spin generates an error (compiling with Viewport). Same problem if you try starting from Task_1.

    Any suggestions?

    Regards
    Andre

    Sample code:
    DEVICE          P8X32A, XTAL1, PLL16X
    XIN             5_000_000
    
    Task_1    TASK
    Task_2    TASK
    
    PROGRAM START
    
    START: 
       COGSTART Task_2
    END
    
    
    TASK Task_1  
       END
    ENDTASK
    
    
    TASK Task_2
       COGSTART Task_1   ' <- This generates a compiler error
       END
    ENDTASK
    
  • BeanBean Posts: 8,129
    edited 2014-04-02 15:21
    Yeah the TASKs do not have access to other TASKs address.

    You might be able to pass the TASK address via a HUB variable.

    Try this:
    DEVICE          P8X32A, XTAL1, PLL16X
    XIN             5_000_000
    
    Task_1    TASK
    Task_2    TASK
    
    temp VAR LONG
    
    Task1Addr  HUB LONG
    
    PROGRAM START
    
    START: 
       \mov temp,Task_1_COG ' Task name with "_COG" appended
       WRLONG task1Addr,temp
    
       COGSTART Task_2
    END
    
    
    TASK Task_1  
    ENDTASK
    
    
    TASK Task_2
    temp_COG VAR LONG
      RDLONG task1Addr,temp_COG
       COGSTART temp ' NOTE: leave off the _COG ending
    ENDTASK
    

    Bean
  • andre.nieuwoudtandre.nieuwoudt Posts: 65
    edited 2014-04-02 17:39
    Hi Bean,

    Thanks, it works like a charm!

    A.
  • Hello all PropBASIC fans!

    Bean has announced some update work to the codebase here:

    http://forums.parallax.com/discussion/166954/propbasic-update-june-2017

    Please check that thread if you'd like to suggest anything toward the new release!

Sign In or Register to comment.