Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 22, 2024, 07:21:26 07:21


Login with username, password and session length


Pages: [1]
Print
Author Topic: Why MikroC's simulator doesn't work?  (Read 9736 times)
0 Members and 1 Guest are viewing this topic.
jlian168
Junior Member
**
Offline Offline

Posts: 59

Thank You
-Given: 0
-Receive: 4


« on: April 01, 2010, 08:58:51 08:58 »

Dear all:
I'm write a simply program to test MikroC for PIC.
I only open timer 1 to use,Then i set a breakpoint in the interrupt,
But the interrupt never be break,I don't why?
Can anyone tell me why?
//************************************************
void interrupt(void) {
     if(TMR1IE_bit)
     {
               if(TMR1IF_bit)
               {
                         TMR1IF_bit=0;
                         TMR1H=(65536-time1_base)/256;
                         TMR1L=(65536-time1_base)%256;

                         if(!(--A))
                                          A=10;
               }
     }
}
//
void main() {
     initial();
     while(1)
     {
             CLRWDT();
             r_cnt++;
     }
}
//
void initial(void) {
     PORTA=0;
     PORTC=0;
     TMR1H=(65536-time1_base)/256;
     TMR1L=(65536-time1_base)%256;
     T1CON=5;
     CMCON0=7;
     OSCCON=0x67;
     OPTION_REG=0xcf;
     ANSEL=0;
     WPUA=0;
     TRISA=0x38;
     TRISC=0x30;
     //TMR1IE_bit=1;
     PIE1=0x01;
     FSR=0x20;
clr_ram:
     INDF=0;
     if(FSR<0x60)
     {
                 FSR++;
                 goto clr_ram;
     }
     A=10;
     PEIE_bit1;
     GIE_bit=1;
/*****************************************************
Thank ypu very much.
Logged
piccolo
Active Member
***
Offline Offline

Posts: 191

Thank You
-Given: 837
-Receive: 968


« Reply #1 on: April 01, 2010, 11:43:00 11:43 »

Interrupt is not automatic in debug mode.
You must manually enter in interrupt function with the key F2.

Or with menu -> Run -> Jump to interrupt.
Logged
sam_des
Senior Member
****
Offline Offline

Posts: 256

Thank You
-Given: 128
-Receive: 151


« Reply #2 on: April 01, 2010, 05:28:49 17:28 »

Hi,

mikroC's debugger is just an "Instruction Set Simulator". That's why it can execute the individual instructions of PIC core but it has no understanding of PIC's peripherals like the Timer you are trying to simulate.

Better use MPLAB or ISIS or even better switch to some other sensible compiler such as cc5x/hi-tech/iar  Tongue

But AFAIK mikroC doesn't output cod/coff/elf or any other files that can be loaded into ISIS or MPLAB. If I remember correctly there was a tool that can convert mikroC files to coff. Search forum or net, you'll get it, but don't how much it works Undecided

Hope that helps,
regards,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
tAhm1D
Senior Member
****
Offline Offline

Posts: 326

Thank You
-Given: 103
-Receive: 180



« Reply #3 on: April 01, 2010, 08:06:20 20:06 »

But AFAIK mikroC doesn't output cod/coff/elf or any other files that can be loaded into ISIS or MPLAB.

mikroC does output coff files. Just get the new one.
Logged
FlvAnm
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 29
-Receive: 3


« Reply #4 on: April 02, 2010, 09:35:40 09:35 »

In mikroC PRO for PIC you can generate coff file to debug C, for example in MPLAB. To generate coff file : Tools -> Opitons -> Output Settings and check Generate COFF file.

Flvanm
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC