Search found 156 matches

by Soumitrab
02 Mar 2024 10:37
Forum: mikroPascal PRO for PIC General
Topic: PIC18F47K42 I2C library incomplete ??
Replies: 2
Views: 142

PIC18F47K42 I2C library incomplete ??

Hi all
The said MCU does not show the I2C_start and I2C_Repeated_Start in the library, rendering the use of the i2c lib impossible.
Is there a workaround to this ?

Thanks in advance
by Soumitrab
13 Dec 2023 08:08
Forum: mikroPascal PRO for PIC General
Topic: PIC18F47K42 interrupt definitions all over
Replies: 0
Views: 205

PIC18F47K42 interrupt definitions all over

Hi
I was updating some UART based code for use with the PIC18F47K42 and i see the definition files have interrupts/enables in different places.
For example TXIE_bit is mentioned (wrongly) in PIE1.B4 AND in PIE3.B4 (as U1TXIE). The datasheet mentions it in PIE3

Just curious why this is so ?
by Soumitrab
31 Jan 2023 06:39
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

Yes, modf is exactly what im looking for.

Thanks @janni, @antimember.
by Soumitrab
29 Jan 2023 13:38
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

AntiMember wrote:
29 Jan 2023 09:39
And in Pascal for PIC there is no modf?
Ohh excellent catch. I totally forgot about this function. Have to try it now. Thanks a ton!! 😊
by Soumitrab
29 Jan 2023 07:11
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

AntiMember wrote:
23 Jan 2023 17:39
I think it's easier to upgrade to a more powerful processor. Writing a float transformation is not at all an easy task.
It's not difficult either, i use a customized routine myself in existing projects and it works flawlessly.
by Soumitrab
29 Jan 2023 07:04
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

And I stay confused - single precision, even in different format (Delphi uses IEEE format), means the same limitation of accuracy and you suggest that Delphi plays miracles and packs more information into 4 bytes than possible. Or is it just the number of decimal places problem, whether they're mea...
by Soumitrab
28 Jan 2023 16:21
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

Janni - the single precision floating point is derived by a strtofloat conversion for storage and transmission as the 4 bytes of a floating point is smaller than a string literal. So that's my primary concern. Upto this point everything is fine but what is method to extract a floattostr with more de...
by Soumitrab
23 Jan 2023 06:16
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

Thats a nice web app, the compiler has a similar function built-in too though.
by Soumitrab
23 Jan 2023 06:13
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

Problem is very simple - i want to convert a floating point value to a string but that conversion is typically limited to 5 decimal places in the FloatToStr routine and so i thought of having a custom routine to show more decimal places.
janni wrote:
21 Jan 2023 16:07
Why don't you describe your problem in some detail?
by Soumitrab
21 Jan 2023 09:19
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

What i meant is : This loss of accuracy isnt worth displaying if its wrong. So is there a way to hack and extract the fractional part without subtracting the integer value and thereby storing the fractional part as an integer in a dword ? Like just extract 11920928955 from 0.00011920928955; ? Or bet...
by Soumitrab
21 Jan 2023 09:15
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

In Delphi i can use the Extended type but thats not supported in MikroPascal.
AntiMember wrote:
20 Jan 2023 10:56
Maybe so:
procedure GetaStr(x: extended; var str: string[23] );
var
w: int64;
tmp,frctn: extended;
..........
by Soumitrab
20 Jan 2023 08:13
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

I Like the closest value. I am happy to use that and truncate the fractional value to 4-5 decimal places just for reporting (as in displaying).
Any ideas/tricks on how to extract and store the fraction as a separate 32bit dword ?
by Soumitrab
19 Jan 2023 20:03
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

Re: FloatToStr with more decimal places displayed ?

i thought so too and have a function ready, but its got a hitch that im unable to resolve. To get the fractional value i do this : procedure GetaStr(x: Real; var str: string[23] ); var w: Longint; tmp,frctn: Real; begin w := Longint(x); Tmp := w * 1.0000000000; frctn:= x - Tmp; .......... Now when x...
by Soumitrab
17 Jan 2023 16:39
Forum: PIC PRO Compilers
Topic: FloatToStr with more decimal places displayed ?
Replies: 29
Views: 3225

FloatToStr with more decimal places displayed ?

Hi
The floattostr routine truncates the number of decimal places to 5 ... so if i want to display something like 0.00000011920928955 all i get is zero.
Is there a routine that can display a user-defined number of decimals ?

Thanks in advance

Go to advanced search