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.
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.
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?
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
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
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
Comments
Regards,
Mickster
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
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
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
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:
You might be able to pass the TASK address via a HUB variable.
Try this:
Bean
Thanks, it works like a charm!
A.
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!