Search found 166 matches

by IstvanK
09 Nov 2021 11:57
Forum: mikroC PRO for PIC General
Topic: Problem logic Rotate right and PIC18F46K22
Replies: 1
Views: 536

Re: Problem logic Rotate right and PIC18F46K22

Why STATUS.C is 1 in this case? Why don't work this case? The C compiler does not guarantee the value of the CARRY bit after such a multiple shifting instructions, it can NOT be used. A workaround: you have to use asm instructions, and to create a loop a DECFSZ instruction, wich does not destroy th...
by IstvanK
06 Mar 2021 15:55
Forum: mikroC PRO for PIC General
Topic: Delay after eeprom read/write
Replies: 7
Views: 1771

Re: Delay after eeprom read/write

The microC Eeprom_Write library function first tests (and waits) whether the previous write process is complete (this can take up to 10 ms). Here is the point: it tests at startup (not after execution). Provide a delay of at least 20 ms (in practice 8 - 10 ms is also enough) between the last EEPROM_...
by IstvanK
04 Mar 2021 01:26
Forum: mikroC PRO for PIC General
Topic: "const absolute" does not work
Replies: 6
Views: 1312

Re: "const absolute" does not work

Try this:

Code: Select all

const short SimpleConstant[] = {0xAA} absolute 0x7F0;
For explanation look at the help of the Directive absolute's Note.
by IstvanK
04 Feb 2021 17:46
Forum: mikroC PRO for PIC General
Topic: Is this a bug or an (un)intentional mistake?
Replies: 9
Views: 1712

Re: Is this a bug or an (un)intentional mistake?

Code: Select all

char position;
char *res;

if (res = strchr(txt, 'E') // ie found
    position = res - txt;  // position is 5 in your case
by IstvanK
03 Dec 2020 16:57
Forum: mikroC PRO for PIC General
Topic: How to assign port bits to the variable bits
Replies: 2
Views: 821

Re: How to assign port bits to the variable bits

An elegant (but not the shortest) solution:
PortBit = VarBit ? 1 : 0;
In your case:

Code: Select all

  count_led = 0b10000001;
  
  LATD.F3 = count_led.F0 ? 1 : 0;
  LATD.F2 = count_led.F1 ? 1 : 0;
  LATE.F5 = count_led.F6 ? 1 : 0;
  LATE.F4 = count_led.F7 ? 1 : 0;
IstvanK
by IstvanK
19 Nov 2020 21:43
Forum: mikroC PRO for PIC General
Topic: strncpy
Replies: 2
Views: 800

Re: strncpy

Try this function (written by me, a long ago):

Code: Select all

char* RstrNcpy(char* dest, char* src, char n)  {
    char* retval = dest; 
    for ( ; n && (R0 = *src) ; *dest = R0, --n, ++src, ++dest);
    *dest = 0;
    return retval;
}
IstvanK
by IstvanK
24 Jun 2020 11:46
Forum: mikroC PRO for PIC General
Topic: Matching Now Time With Time Read From A RTC
Replies: 3
Views: 1119

Re: Matching Now Time With Time Read From A RTC

Hi Ditch;
This is possible only if the RTC is set to 12-hour mode AND the hours register's value is treated as a 24-hour BCD value (see datasheet).
Try to set your RTC to 24-hour mode: initialize bit 6 of the hours register (at address 0x02) to zero.
by IstvanK
12 Jun 2020 22:57
Forum: mikroC PRO for PIC General
Topic: How to corrupt a pointer to a string stored in flash?
Replies: 2
Views: 1011

Re: How to corrupt a pointer to a string stored in flash?

Hi jumper,

Code: Select all

const char *msg41="AT+CIPSTATUS\r\n ";
your msg41 is a pointer (stored in RAM so modifiable) to a string stored in Flash.

Use a const char array (a string) instead:

Code: Select all

const char msg41[] = "AT+CIPSTATUS\r\n ";
by IstvanK
09 Jun 2020 19:07
Forum: mikroC PRO for PIC General
Topic: IDE Froze!
Replies: 4
Views: 1307

Re: IDE Froze!

Hi Steve; Sometimes I encounter this problem too, but I already know that the IDE does not freeze (returns by pressing ESC), it just displays the "Search and Replace" window incorrectly, in a wrong, invisible place. So (if the IDE "freezes" after the Ctrl-R), you need to do the following: - press ES...
by IstvanK
03 Jun 2020 22:31
Forum: mikroC PRO for PIC General
Topic: Memory efficient Alternative To Sprintf
Replies: 4
Views: 1377

Re: Memory efficient Alternative To Sprintf

I think this is smaller and faster ... char buffer[3]; // to accomodate two digits and the zero (end) sign char i; // input value, 0 >= i <= 99 char tmp; // local var, R0 also can be used instead for ( tmp = '0' ; i > 9 ; ++tmp, i -= 10); buffer[0] = tmp; // i/10 buffer[1] = i + '0'; // i%10 buffer[...
by IstvanK
11 Apr 2019 11:42
Forum: mikroC PRO for PIC General
Topic: Ds3231 RTC: temperature display
Replies: 3
Views: 2123

Ds3231 RTC: temperature display

On request I wrote a simple and fast function to display the temperature measured by the Ds3231 internal sensor. - no any floating operation (integer arithmetic only) - no any character buffer : each digit is displayed immediately, after it's computed. From the Ds3231 datasheet: Temperature is repre...
by IstvanK
18 Mar 2019 16:15
Forum: mikroC PRO for PIC General
Topic: mikkroC 7.2 Bad News
Replies: 8
Views: 2629

Re: mikkroC 7.2 Bad News

Hi keedo;
Based on your uploaded images, I think you tried to install the v7.20 on a virtual machine running XP, but as we know, this version is not compatible with the XP.
Look at this posts:
viewtopic.php?f=88&t=71710
by IstvanK
27 Feb 2019 14:03
Forum: mikroC PRO for PIC General
Topic: unexpected results from example code
Replies: 5
Views: 1412

Re: unexpected results from example code

Maybe a missing ANSEL? setting?
Study the datasheet.
by IstvanK
06 Nov 2018 17:25
Forum: mikroC PRO for PIC General
Topic: LCD Alarm Clock using a PIC12F629
Replies: 0
Views: 1124

LCD Alarm Clock using a PIC12F629

Full function alarm clock using a DS1307: - (only) two-button treatment, 16x2 LCD with I2C 'backpack', blinking alarm LED - adjustable RTC time-date, the (abbreviated) name of the day too - settable alarm (status, hours and mins), stored also in RTC user ram - restore alarm settings at next power-on...
by IstvanK
06 Oct 2018 16:30
Forum: mikroC PRO for PIC General
Topic: EEPROM and button as a counter
Replies: 5
Views: 1756

Re: EEPROM and button as a counter

Hi cyril341; Make sure that if an EEPROM_Write () is followed by an EEPROM_Read (), there is enough time (10 ms) to finish the writing (before the reading). In your code it may be enough to put the delay before the last EEPROM_Read() .... at the end of the code: EEPROM_Write (0x88,count); // Invert ...

Go to advanced search