Search found 1119 matches

by aCkO
16 Jan 2017 09:04
Forum: mikroC PRO for PIC General
Topic: Problems with array in structure...
Replies: 20
Views: 7375

Re: Problems with array in structure...

How i can define flash blocks values in my structure variable named "const zone_t polygon[cantidad_poligonos_declarados]" ? It looks like you can't see the forest for the trees :) If you define a pointer to flash block like: const zone_t * ptr = (const zone_t *)0xC000; and also take advantage of fu...
by aCkO
12 Jan 2017 15:29
Forum: mikroC PRO for PIC General
Topic: Problems with array in structure...
Replies: 20
Views: 7375

Re: Problems with array in structure...

Code: Select all

zone_t tmp = *(const zone_t *)0xCCCC;

// access tmp members here
or if you wish to save RAM, just use a pointer to struct:

Code: Select all

const zone_t * ptr = (const zone_t *)0xCCCC;

// vertices: ptr->vertices
// lat: ptr->lat[0]
// etc...
Regards
by aCkO
25 Mar 2016 05:38
Forum: mikroC PRO for PIC General
Topic: float problem
Replies: 6
Views: 2227

Re: float problem

Spherical law of cosines formula for distance calculation is not well-conditioned for single precision floats. Use haversine formula.

See here: http://forum.mikroe.com/viewtopic.php?f=88&t=64001

Regards
by aCkO
25 Mar 2016 05:31
Forum: mikroC PRO for PIC General
Topic: pointer to float
Replies: 3
Views: 1615

Re: pointer to float

Code: Select all

#include "built_in.h"

unsigned short aux1, aux2, aux3, aux4;
float y = 3.5;

aux1 = Lo(y);
aux2 = Hi(y);
aux3 = Higher(y);
aux4 = Highest(y);
NOTE: You don't even need aux variables.

Regards
by aCkO
15 Mar 2016 03:31
Forum: mikroC PRO for PIC32 General
Topic: Why redefinition error???????
Replies: 5
Views: 2915

Re: Why redefinition error???????

Usually I declare extern variables in a header file! It doesn't matter where you declare them. Only source files are compiled. The content of header files is just included in them by the preprocessor. Preprocessor is not an integral part of a C compiler. In fact, the preprocessor used by mC is not ...
by aCkO
14 Mar 2016 10:02
Forum: mikroC PRO for PIC General
Topic: char and short are the same type of data?
Replies: 3
Views: 2020

Re: char and short are the same type of data?

akael wrote:thanks for your reply
Is there any data 2 bytes? like a short type in c++
Of course:
int - 2-byte signed integer
unsigned int - 2-byte unsigned integer
long - 4-byte signed integer
unsigned long - 4-byte unsigned integer

Regards
by aCkO
13 Mar 2016 20:20
Forum: mikroC PRO for PIC General
Topic: char and short are the same type of data?
Replies: 3
Views: 2020

Re: char and short are the same type of data?

In mikroC:
char is 1-byte unsigned integer
short is 1-byte signed integer
unsigned short is equivalent to char

Regards
by aCkO
11 Mar 2016 15:15
Forum: mikroC PRO for PIC32 General
Topic: Why redefinition error???????
Replies: 5
Views: 2915

Re: Why redefinition error???????

I'll answer your question with another question related to your example. Imagine you have a third source file with an extern defined as: extern unsigned char _g_Cnt; Q: Which variable does extern refer to? The one from _UCT.c or the one from _DCT.c? Declaring a global object as static would be the e...
by aCkO
10 Mar 2016 23:35
Forum: mikroC PRO for PIC32 General
Topic: Why redefinition error???????
Replies: 5
Views: 2915

Re: Why redefinition error???????

bugOnLine99 wrote:Anyone understand why we can't declare two variables with the same name and each in their own .c file ?
You can if you add static storage class specifier.

Regards
by aCkO
08 Mar 2016 22:47
Forum: mikroC PRO for PIC General
Topic: About of pragma funcall
Replies: 2
Views: 1613

Re: About of pragma funcall

Try:

Code: Select all

#pragma funcall loadTask func1
Regards
by aCkO
05 Mar 2016 03:54
Forum: mikroC PRO for PIC32 General
Topic: Advanced question!
Replies: 5
Views: 3926

Re: Advanced question!

That can happen only if the project didn't compile and mikroProg uses old hex file or you specified wrong search paths in project settings (Project -> Edit Search Paths...). I suggest you to try the following: 1. Open your *.h file and make the change 2. Delete everything from project folder except ...
by aCkO
05 Mar 2016 01:24
Forum: mikroC PRO for PIC32 General
Topic: Advanced question!
Replies: 5
Views: 3926

Re: Advanced question!

The problem is that when I do this without opening the MikroC gui but instead I use the DOS command lines to download my program, the new User.h file(the last one I copied into the PIC32 directory) is not seen. It still keeps the information of the old User.h file WHICH I DELETED!!!! I might be wro...
by aCkO
03 Mar 2016 18:11
Forum: mikroC PRO for PIC32 General
Topic: Command line compilation Problem?
Replies: 4
Views: 3103

Re: Command line compilation Problem?

After compilation just copy-paste the first line from messages window. It contains the command-line call to compiler.

Regards
by aCkO
01 Mar 2016 20:11
Forum: mikroBasic PRO for PIC General
Topic: CRC question
Replies: 4
Views: 1949

Re: CRC question

http://www.mikroe.com/download/eng/documents/compilers/mikrobasic/pro/pic/help/rs-485_library.htm It is in C but it is easy to translate to Basic: CRC generation : ---------------- crc_send = datalen xor address crc_send = crc_send xor data[0] ' if exists crc_send = crc_send xor data[1] ' if exists ...

Go to advanced search