 |
 |
View previous topic :: View next topic |
Author |
Message |
apcaye
Joined: 22 May 2009 Posts: 29 Location: Brazil
|
|
Posted: Wed May 27, 2009 2:20 pm |
|
|
If you set CMIF flag and the interrupt routine is called, it's because the comparator interrupt is enabled indeed. There is nothing else to be configured related to that. I ask you then: do you have input signals in the comparator input pins that really should cause an interrupt? Have you watched them with an oscilloscope or a multimeter?
Adriano. |
|
 |
Salenko
Joined: 08 Sep 2008 Posts: 84
|
|
Posted: Wed May 27, 2009 3:43 pm |
|
|
apcaye wrote: | If you set CMIF flag and the interrupt routine is called, it's because the comparator interrupt is enabled indeed. There is nothing else to be configured related to that. I ask you then: do you have input signals in the comparator input pins that really should cause an interrupt? Have you watched them with an oscilloscope or a multimeter?
Adriano. |
thank you for your quick answer,
Yes, I have input signals in the comparator input pins that really should cause an interrupt. it's an input of a virtual Pulse generator (I'm simulating with isis), I have the circuit on the breadboard, but I prefer to see my code working as I expect before programming the PICmicro. |
|
 |
apcaye
Joined: 22 May 2009 Posts: 29 Location: Brazil
|
|
Posted: Thu May 28, 2009 9:06 am |
|
|
You're right, you should see your code working in the simulation before flashing it to the micro controller. And what about the TRIS register, have you checked if the comparator input pins are really configured as input (logic 1) and the comparator output as output (logic 0)?
Adriano. |
|
 |
Ttelmah Guest
|
|
Posted: Thu May 28, 2009 9:13 am |
|
|
There does come a point, where it is worth trying a simple test in the real hardware. If you search here, you will find that emulators are not perfect. There have been a number of issues in the past, with the Proteus simulator, and I wonder if this is another. At the least, try with another simulator. The MPLAB simulator, is free, and is one of the best. So though I'd agree 'in general', testing in the simulator first is the way to go, there is also a point, where 'beating your head against a wall', is silly, and it is worth trying 'for real', as part of the isolation process.
Given that modern chips are generally not OTP devices. It is not as if this is expensive to do...
Best Wishes |
|
 |
Salenko
Joined: 08 Sep 2008 Posts: 84
|
|
Posted: Thu May 28, 2009 10:30 am |
|
|
Hi apcaye & Ttelmah,
apcaye wrote: | You're right, you should see your code working in the simulation before flashing it to the micro controller. And what about the TRIS register, have you checked if the comparator input pins are really configured as input (logic 1) and the comparator output as output (logic 0)?
Adriano. |
Yes, the TRISA is set, by the compiler, to 47 (0b00101111) which means that the inputs of the comparator are configured as inputs, and the its output is configured as output.
Ttelmah wrote: | There does come a point, where it is worth trying a simple test in the real hardware. If you search here, you will find that emulators are not perfect. There have been a number of issues in the past, with the Proteus simulator, and I wonder if this is another. At the least, try with another simulator. The MPLAB simulator, is free, and is one of the best. So though I'd agree 'in general', testing in the simulator first is the way to go, there is also a point, where 'beating your head against a wall', is silly, and it is worth trying 'for real', as part of the isolation process.
Given that modern chips are generally not OTP devices. It is not as if this is expensive to do...
Best Wishes |
thank you for your advice Ttelmah, I also use MPLAB SIM (didn't you see the screen captures on the first page of this thread ?),
but now I'm going to do the test for real. |
|
 |
Ttelmah Guest
|
|
Posted: Thu May 28, 2009 1:20 pm |
|
|
I thought somewhere you had mentioned the isis/proteus simulator.
I was suggesting that you tried another. Unfortunately, if you are using MPLAB, then there is not another free one, though you should be able to get an eval version of proteus.
Also, just try another version of MPLAB. Get an older one, or a newer one.
The 'fact' that CMIE does not set in your simulation, has all the 'smells' of a simulator problem.
Best Wishes |
|
 |
Salenko
Joined: 08 Sep 2008 Posts: 84
|
|
Posted: Thu May 28, 2009 3:19 pm |
|
|
Ttelmah wrote: | I thought somewhere you had mentioned the isis/proteus simulator.
I was suggesting that you tried another. Unfortunately, if you are using MPLAB, then there is not another free one, though you should be able to get an eval version of proteus.
Also, just try another version of MPLAB. Get an older one, or a newer one.
The 'fact' that CMIE does not set in your simulation, has all the 'smells' of a simulator problem.
Best Wishes |
To make something clear, I used MPLAB SIM (8.3) and isis/proteus (7.1).
Both of them "simulated" fine the same code with 16F628. |
|
 |
Salenko
Joined: 08 Sep 2008 Posts: 84
|
|
Posted: Sat May 30, 2009 1:21 am |
|
|
Salenko wrote: |
but now I'm going to do the test for real. |
it worked.
advice: don't trust the simulators !
thank you Ttelmah & apcaye. |
|
 |
apcaye
Joined: 22 May 2009 Posts: 29 Location: Brazil
|
|
Posted: Mon Jun 01, 2009 6:19 am |
|
|
You're welcome, Salenko. Agreed, the simulators are not always right, although I have to say that the MPLAB simulator use to work very well, it never disappointed me.
Adriano. |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|