News:

Let's find out together what makes a PIC Tick!

Main Menu

Array initialization

Started by broderic, Jun 14, 2021, 08:14 AM

Previous topic - Next topic

broderic

Hello.
What is the quicker way to initialize an array with values in Proton, like the C example:

const int8_t var[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0} ?

And in general, how can I initialize a variable?
I found some code like this:
Dim invert as bit = 0

Thank you and sorry for the silly question.

top204

#1
See page 19 of the Positron8 compiler's manual "Pre-Assigning Variables", and page 46 of the manual: "Creating and using Arrays"

The mechanism on page 446 also applies to assigning to a RAM array, where the open and close curly braces '{ }' are used and no line continuation characters are required, just commas at the end of a line of data.

broderic

Thanks a lot, Les.
My question was because I still have version 3.7.5.5, and in the manual pointed for it there was not this indication, if I'm not wrong. Even if I admit that it was quite intuitive:-).

Many thanks for your work to create and improve this beautiful compiler, that I like.
I prefer working with it, instead with Arduino, for instance (where all is "library" and you learn nothing, in my opinion).

One more question: if I want to by the complete compiler, clicking on "buy Positron" it tells me that it is ended.
And, if I still work with windows XP, does the latest version of the compiler still work OK?

Thank you.

top204

#3
Many thanks Broderic.

I no longer use Ebay because they are becoming even bigger thieves than they were originally, and are now "not" using PayPal and want too much personal information and an official ID photo before they will release any money for sales! Talk about ID theft being common place, no wonder with stupid companies like that! One breach of their database and they will have "all" the information for a person for no reason whatsoever!

As soon as I can find the time, and money, to make my own web site, I will be adding PayPal to it, but for now... See this page:
https://sites.google.com/view/rosetta-tech/home/how-to-purchase-the-positron-compilers

The compilers still work with Windows XP and Windows 7 and Windows 8 and Windows 10 etc... And both 32-bit and 64-bit versions.

Apart from the extra features and devices that have been added to the compilers, they are still Proton, and it is a name change to finally get away from Cr#w*~i#l. The "full" purchase of the compilers no longer need the USB key, and never will need it, so they can be installed on any computer that you own. The registration is a personalised type, so the buyer's name is embedded into the compilers. No extra info is used or stored, just the name of the purchaser. The "upgrade" to the compilers will still require the USB key for registration, however, over time, I will be removing support for the USB key altogether.

You can veiw the latest manuals from my google site here: https://sites.google.com/view/rosetta-tech/home