Search found 51 matches

by janni
Sat Jul 01, 2023 2:01 pm
Forum: General
Topic: Blink PortB on a 18F2620
Replies: 8
Views: 3808

Re: Blink PortB on a 18F2620

Looking at the datasheet there is no OSCCON, just OSCTUNE. OSCCON register is certainly present and its setting required. See chapter 2.7.1 OSCILLATOR CONTROL REGISTER of the datasheet. It's safer to clear whole OSCTUNE register, not just the PLL bit. And if you want to switch all analog inputs off...
by janni
Thu Feb 02, 2023 4:40 pm
Forum: Compiler
Topic: Interrupts and variable saving
Replies: 13
Views: 12214

Re: Interrupts and variable saving

Hi Ioannis, There are processor registers that the compiler uses and are not visible in Basic. That's one of the reasons we use high-level programming languages - to abstract from processor innards. Unfortunately, especially in small processors, that's not always possible. In this case, TBLPTR regis...
by janni
Wed Jan 04, 2023 1:49 am
Forum: Modules
Topic: Interrupts
Replies: 6
Views: 1975

Re: Interrupts

Since this application cant miss any serial commands i need to implement a high priority ISR to capture the USART serial data, even when a sound is being played. Before you fix the context saving following Jerry's instructions, you cold rethink the algorithm over. Unless you use very high communica...
by janni
Wed Dec 14, 2022 2:36 pm
Forum: Compiler
Topic: access to characters in string constant
Replies: 10
Views: 9802

Re: access to characters in string constant

I'm not sure I follow what you're getting at here. Where is the 255 char limit? Well, it's in Help Type Bit Size Range -------------------------------------------------------- String Variable Multiple (up to 255) characters Swordfish enables you to specify string sizes of up to 256 bytes, which equ...
by janni
Wed Dec 14, 2022 11:57 am
Forum: Compiler
Topic: access to characters in string constant
Replies: 10
Views: 9802

Re: access to characters in string constant

Right. I've seen this option but forgotten about it :oops: . Still, as one cannot pass string constant by reference, I'll have to use the workaround.
by janni
Tue Dec 13, 2022 8:31 pm
Forum: Compiler
Topic: access to characters in string constant
Replies: 10
Views: 9802

Re: access to characters in string constant

It hopefully will get fixed but internally, it's a complicated change to the compiler and I certainly don't want to break anything! Nobody wants the latter :evil: and thanks for the promise :) . Purely out of interest, why are you accessing a constant in this way in your code? I was writing own str...
by janni
Tue Dec 13, 2022 12:14 pm
Forum: Compiler
Topic: access to characters in string constant
Replies: 10
Views: 9802

Re: access to characters in string constant

However, you can use an array of char constants... Yes, but then it cannot be treated as string, not to mention all the additional commas and quotation marks required. It's a known issue. Usually, after such sentence there's one promising that something will be done about it (though not necessarily...
by janni
Mon Dec 12, 2022 4:38 pm
Forum: Compiler
Topic: access to characters in string constant
Replies: 10
Views: 9802

access to characters in string constant

It seems that while one can access single characters in a string variable the same isn't possible for string constants. dim txt as string(11) = "1234567890" const txtC = "1234567890" dim ch as char ch=txt(1) ch=txtC(1) // incompatible types error Also an attempt to assign single character from strin...
by janni
Fri Sep 30, 2022 11:16 pm
Forum: Compiler
Topic: big float constant
Replies: 14
Views: 6583

Re: big float constant

That last is disturbing :( . I don't know why fp values would need to be converted to text form without exponent (mistake in choice of converting function?), usual algorithms converting fp value to Microchip format do not require it, but apparently the person who developed this haven't foreseen all ...
by janni
Fri Sep 30, 2022 10:16 pm
Forum: Compiler
Topic: big float constant
Replies: 14
Views: 6583

Re: big float constant

Indeed, though it'll matter only if there's an automatic conversion of declared value to text and back. I still don't grasp the significance of the conversion to text other than, when incorrectly done, it either causes rejection of the value or crashes the IDE. If it serves to consecutive evaluation...
by janni
Fri Sep 30, 2022 9:07 pm
Forum: Compiler
Topic: big float constant
Replies: 14
Views: 6583

Re: big float constant

All floating point values are converted from an exponential format to a straight decimal format before assembly. The buffer is approx 43 chars (42+sign) in length, so this can put a limit on what's actually used. This should be enough to hold maximal Microchip format value. Probably the conversion ...
by janni
Thu Sep 29, 2022 9:15 pm
Forum: Compiler
Topic: big float constant
Replies: 14
Views: 6583

Re: big float constant

The more I look at it, the more it seems like simple mistake. Maximum positive value in Microchip notation is 6.8056469E38 ($FF7FFFFF) and that's exactly the value that compiler blocs but with decimal power of 37 instead of 38. Naturally, as the internal floating-point library assigns +/-3.4028236E3...
by janni
Thu Sep 29, 2022 3:21 pm
Forum: Compiler
Topic: big float constant
Replies: 14
Views: 6583

Re: big float constant

The compiler expands all floating-point constant values to a fixed-point representation, so anything past approx E+/-37 can cause issues. Apparently not all floating-point constants, just those explicitly declared as float :( . And that's about the limit of approximately 9.2E18 (64 bit integer limi...
by janni
Thu Sep 29, 2022 12:21 am
Forum: Compiler
Topic: big float constant
Replies: 14
Views: 6583

Re: big float constant

Yes, it's IDE problem (I should have posted it in IDE forum) but there's also a problem within the compiler. Under MPLABX one also cannot use too big numbers as they're reported out of range. According to Help file, max range for float type is -1e37 to +1e38 though internally it's close to +/-3.4E38...
by janni
Wed Sep 28, 2022 3:25 pm
Forum: Compiler
Topic: big float constant
Replies: 14
Views: 6583

big float constant

Somehow big constants of type float are not accepted. Cannot declare in a module constant larger than ca. 9.2E18 (anything bigger causes rest of module to vanish from Code Explorer and compilation) and attempt to declare such constant in main module may even cause SF IDE to crash :( .