CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Help with this code for APDS-9930 proximity sensor
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jul 01, 2020 5:08 am     Reply with quote

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

View user's profile Send private message ICQ Number

PostPosted: Wed Jul 01, 2020 11:06 pm     Reply with quote

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: 19195

View user's profile Send private message

PostPosted: Thu Jul 02, 2020 12:47 am     Reply with quote

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.... Very Happy
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jul 02, 2020 5:19 am     Reply with quote

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...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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