|
|
View previous topic :: View next topic |
Author |
Message |
temtronic
Joined: 01 Jul 2010 Posts: 9269 Location: Greensville,Ontario
|
|
Posted: Wed Jul 01, 2020 5:08 am |
|
|
You should disconnect the interrupt wiring and check that you can manually cause an interrupt. This will confirm your PIC ISR and HW is OK.....
Once you confirm it works, then reconnect the peripheral and check code related to it for proper configuration and setup as Mr T says ... |
|
|
juca85
Joined: 28 Jun 2020 Posts: 8 Location: Colombia
|
|
Posted: Wed Jul 01, 2020 11:06 pm |
|
|
Ttelmah wrote: | There are a huge number of things that affect how/when the interrupt
will trigger.
You have first of all, the PIEN, and AIEN fields to determine if the
interrupt is enabled. Then the upper and lower limit fields. Then the
persistence fields determine how long the trigger must exist before the
interrupt will fire. At this point it will optionally put the chip to sleep
as well.
AIL, AIH, PIL, PIH, PERS all need to be set correctly. Also you should
clear the interrupt in case is has been set on boot. |
Thaks for all, finally I can't make it work the interrupt, i configure the sensor for read values and put an if in the code for >= and work perfect, maybe later play with that, for now is all i need......... thanks again. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19589
|
|
Posted: Thu Jul 02, 2020 12:47 am |
|
|
OK.
A bit of a 'bodge', but at least it is working.
If you want to further pursue the interrupt, I suggest you post your interrupt
setup, interrupt code, and the settings being put into all the registers.
My guess would be a detail somewhere in one of the settings.... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9269 Location: Greensville,Ontario
|
|
Posted: Thu Jul 02, 2020 5:19 am |
|
|
I was curious, so I downloded the devices PDF... Page 12 describes the interrupts and if the lower threshold is set higher than the higher....oopsy !
As Mr. T. suggests ,post your setup code. It could be a simple high byte<>low byte swap that's putting the wrong data into a register.
I'd configure the device then wait 1 second , then read all the registers back and CONFIRM the data IS what I sent to it... Have a chart of 'should be values vs what is there', code a simple read the registers, display register address and data for 1 second, write down the data on the chart... |
|
|
|
|
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
|