Author |
Message |
Topic: Help with this code for APDS-9930 proximity sensor |
juca85
Replies: 18
Views: 40934
|
Forum: General CCS C Discussion Posted: Wed Jul 01, 2020 11:06 pm Subject: Help with this code for APDS-9930 proximity sensor |
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 low ... |
Topic: Help with this code for APDS-9930 proximity sensor |
juca85
Replies: 18
Views: 40934
|
Forum: General CCS C Discussion Posted: Tue Jun 30, 2020 2:20 pm Subject: Help with this code for APDS-9930 proximity sensor |
Pins always wake set as inputs. Unless you switch them, or automatic
switching is done (as will happen when you setup the I2C), these settings
remain.
ok i connect a LCD 20x2 for see the write a ... |
Topic: Help with this code for APDS-9930 proximity sensor |
juca85
Replies: 18
Views: 40934
|
Forum: General CCS C Discussion Posted: Tue Jun 30, 2020 12:38 am Subject: Help with this code for APDS-9930 proximity sensor |
If you configure the I2C as I show, the PortB configuration is all done.
The interrupt pin is necesary set as input? |
Topic: Help with this code for APDS-9930 proximity sensor |
juca85
Replies: 18
Views: 40934
|
Forum: General CCS C Discussion Posted: Mon Jun 29, 2020 11:19 pm Subject: Help with this code for APDS-9930 proximity sensor |
Your PIC is not rated to run at 3.3v.
Hence the comments about this.
The 18F4550, is rated for 4.2v _minimum_.
To run below this you need the LF version (PIC18LF4550).
Yes you right!, but the s ... |
Topic: Help with this code for APDS-9930 proximity sensor |
juca85
Replies: 18
Views: 40934
|
Forum: General CCS C Discussion Posted: Mon Jun 29, 2020 11:05 am Subject: Help with this code for APDS-9930 proximity sensor |
There is a glaring problem.
You have a 5v PIC. This is a 3.3v device.
If you have connected your PIC Vcc to this, you have probably destroyed
the chip. It is rated for 3.8v _max_.
The I2C inp ... |
Topic: Help with this code for APDS-9930 proximity sensor |
juca85
Replies: 18
Views: 40934
|
Forum: General CCS C Discussion Posted: Sun Jun 28, 2020 10:45 pm Subject: Help with this code for APDS-9930 proximity sensor |
Your original code showed:
i2c_write(0x39);
The command register is always selected, when you start a write
transaction.
So sequence is:
start
Write devive address
Write to command reg ... |
Topic: Help with this code for APDS-9930 proximity sensor |
juca85
Replies: 18
Views: 40934
|
Forum: General CCS C Discussion Posted: Sun Jun 28, 2020 5:48 pm Subject: Help with this code for APDS-9930 proximity sensor |
First key thing is this:
0x39
Wrong....
The PIC uses an 8bit address. Means that translating from any device using
the 7bit address format, you have to multiply the number by 2.....
Then ... |
Topic: Help with this code for APDS-9930 proximity sensor |
juca85
Replies: 18
Views: 40934
|
Forum: General CCS C Discussion Posted: Sun Jun 28, 2020 12:58 am Subject: Help with this code for APDS-9930 proximity sensor |
Hello i need help with this code.
This code appears on the sensor data sheet APDS-9930:
WriteRegData(uint8 reg, uint8 data)
{
m_I2CBus.WriteI2C(0x39, 0x80 | reg, 1, &data) ... |
|