Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

mikro c program is showing error 392

Status
Not open for further replies.
hi all;

i am using pic16f877a in a project. for software i am using Mikro c pro for pic. now this is giving me a strange error... i don't know how to solve it.. i tried my best to solve it but cant understand...
plz c the image below for the error:

View attachment 68582

kindly tell me why this error occurs i.e; what are the causes of that error and how to remove it.

thanking you in anticipation
 
That not totally so the routine does not fit within one page

At first I thought that, but the error 392 after the 342 specify an address range that is out of ANY page... So the program counter is so high it must have gone negative...

14 bits remember... All I can assume there is an extremely large rom table.
 
Last edited:
The OP needs to post the whole code it still could be Crossing page boundary I've seen this happen before using the LCD and delay libraries
 
thank you very much Ian Rogers and be80be. i have optimize my code and solved my problem. yes you are right it is due to a large use of delays and lcd libraries. is there any other technique to save the ram space and to do more compact programming???
can you please give me some techniques to make program more compact? thanking you in advance.
 
Without seeing how you are currently programming things, it's very difficult to advice how to make it better.

Mike.
 
Could you post your code so we can comment it and maybe give some good advice. Post it as an attached file. I rarely see 1500 lines of C code for 8-bit micro.
 
Last edited:
Well like it been said post your code, But there something about the delay library I can't remember what it was but I just unclicked all the junk I wasn't using on the right pane of the ide. and made my own delays with out the library bloat. I'll show you what you need to un-click
View attachment 68599
 
its a good tip be80be. i unclicked the liabraries but situation is the same as it was.... before unclicking the free rom space was 19% and the same 19% is there after unclicking it.......... :confused:
 
Yep that's true. Un-clicking the libraries speeds up compilation as the compiler does not need to check a heap of stuff, but generally the build size and ROM used will depend on the actual functions used in the code.
 
I think we can only help you if you post your code file "ATS.c". Please post that and I promise you will get lots of good help.
 
They may of fixed it to but on the forum some one told me from MiKroC that it adds to the size when using the delay
it called stuff you didn't use.
 
From what I undertsand MikroC has Delay_ and VDelay_ functions built in, they are not in a library, at least not in the compiler version I use.

Delay_ functions turn into inline code and can chew up a lot of ROM if there are a lot of them in the code. Maybe that's what they were saying?

VDelay_ uses a variable to set the delay time and one function to do all the delays, so the cost in ROM is much smaller.
 
Here what delay_ms does
Code:
_main:

;testDelay.c,1 ::                 void main() {
;testDelay.c,2 ::                 TRISB = 0;
        CLRF       TRISB+0
;testDelay.c,3 ::                 PORTB = 0;
        CLRF       PORTB+0
;testDelay.c,4 ::                 while (1) {
L_main0:
;testDelay.c,5 ::                 PORTB = ~ PORTB;
        COMF       PORTB+0, 1
;testDelay.c,6 ::                 Delay_ms (1000);
        MOVLW      11
        MOVWF      R11+0
        MOVLW      38
        MOVWF      R12+0
        MOVLW      93
        MOVWF      R13+0
L_main2:
        DECFSZ     R13+0, 1
        GOTO       L_main2
        DECFSZ     R12+0, 1
        GOTO       L_main2
        DECFSZ     R11+0, 1
        GOTO       L_main2
        NOP
        NOP
;testDelay.c,7 ::                 PORTB = ~ PORTB;
        COMF       PORTB+0, 1
;testDelay.c,8 ::                 Delay_ms (1000);
        MOVLW      11
        MOVWF      R11+0
        MOVLW      38
        MOVWF      R12+0
        MOVLW      93
        MOVWF      R13+0
L_main3:
        DECFSZ     R13+0, 1
        GOTO       L_main3
        DECFSZ     R12+0, 1
        GOTO       L_main3
        DECFSZ     R11+0, 1
        GOTO       L_main3
        NOP
        NOP
;testDelay.c,9 ::                 PORTB = ~ PORTB;
        COMF       PORTB+0, 1
;testDelay.c,10 ::                 Delay_ms (1000);
        MOVLW      11
        MOVWF      R11+0
        MOVLW      38
        MOVWF      R12+0
        MOVLW      93
        MOVWF      R13+0
L_main4:
        DECFSZ     R13+0, 1
        GOTO       L_main4
        DECFSZ     R12+0, 1
        GOTO       L_main4
        DECFSZ     R11+0, 1
        GOTO       L_main4
        NOP
        NOP
;testDelay.c,11 ::                 PORTB = ~ PORTB;
        COMF       PORTB+0, 1
;testDelay.c,12 ::                 Delay_ms (1000);
        MOVLW      11
        MOVWF      R11+0
        MOVLW      38
        MOVWF      R12+0
        MOVLW      93
        MOVWF      R13+0
L_main5:
        DECFSZ     R13+0, 1
        GOTO       L_main5
        DECFSZ     R12+0, 1
        GOTO       L_main5
        DECFSZ     R11+0, 1
        GOTO       L_main5
        NOP
        NOP
;testDelay.c,13 ::                 PORTB = ~ PORTB;
        COMF       PORTB+0, 1
;testDelay.c,14 ::                 Delay_ms (1000);
        MOVLW      11
        MOVWF      R11+0
        MOVLW      38
        MOVWF      R12+0
        MOVLW      93
        MOVWF      R13+0
L_main6:
        DECFSZ     R13+0, 1
        GOTO       L_main6
        DECFSZ     R12+0, 1
        GOTO       L_main6
        DECFSZ     R11+0, 1
        GOTO       L_main6
        NOP
        NOP
;testDelay.c,15 ::                 }
        GOTO       L_main0
;testDelay.c,16 ::                 }
L_end_main:
        GOTO       $+0
; end of _main
 
Status
Not open for further replies.

Latest threads

Back
Top