Please Help Me!!(PIC18F47Q10_I2C)
Moderator: Benj
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
Please Help Me!!(PIC18F47Q10_I2C)
Hello!!
I want to receive data from MCP3421 to I2C using PIC18F47Q10. However, no data is received.
So, I verified it through the oscilloscope and logic analyzer, but there is no response from the MCU pin. No schematic problem. FC8 was also reinstalled. But the result is the same.
Also, please review the touch sensor.
Help.
I want to receive data from MCP3421 to I2C using PIC18F47Q10. However, no data is received.
So, I verified it through the oscilloscope and logic analyzer, but there is no response from the MCU pin. No schematic problem. FC8 was also reinstalled. But the result is the same.
Also, please review the touch sensor.
Help.
- Attachments
-
- I2C_MCP3421_Test.fcfx
- (26.4 KiB) Downloaded 214 times
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
Re: Please Help Me!!(PIC18F47Q10_I2C)
Hi Seokgi
Is the counting ok in this way?
Do you have pullup resistor for the I2C bus?
With your oscilloscope did you see the clock and data you are sending?
regards
Stefan
Is the counting ok in this way?
Do you have pullup resistor for the I2C bus?
With your oscilloscope did you see the clock and data you are sending?
regards
Stefan
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
Re: Please Help Me!!(PIC18F47Q10_I2C)
I pulled up 4.7Kohm resistors on SDA, SCL.
And when viewed with an oscilloscope, the clock is not generated in SCL.
Heart count monitors MCU operation status. Heart count doesn't make sense here, but it works fine.
And when viewed with an oscilloscope, the clock is not generated in SCL.
Heart count monitors MCU operation status. Heart count doesn't make sense here, but it works fine.
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
Re: Please Help Me!!(PIC18F47Q10_I2C)
Hi Seokgi
You need a clock to send and read I2C
Check if the IRQ is working, Remove for a test the 100ms Delay or make a loop in the main for a simple clocktest.
An with your oscilloscope, the pin is always hi (not low)?
If you never have a clock we have to look at this
DS40002043D-page 8 did you see this? I hope it's not a problem
You need a clock to send and read I2C
Check if the IRQ is working, Remove for a test the 100ms Delay or make a loop in the main for a simple clocktest.
An with your oscilloscope, the pin is always hi (not low)?
If you never have a clock we have to look at this
DS40002043D-page 8 did you see this? I hope it's not a problem
This is a PPS remappable input signal
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
Re: Please Help Me!!(PIC18F47Q10_I2C)
I think you are correct with your channel1 and the pins
Maybe there is config problem of the pic.
Can you change to softwaremode for the I2C and
have a look for the clocksignal with the oscilloscope?
Can you also include a Pin or LED in the Irq and test with oscilloscope if there is always an Irq?
And if all of this not help trie to use in softwaremode an another pin just for the clock to test it with the oscilloscope
Maybe there is config problem of the pic.
Can you change to softwaremode for the I2C and
have a look for the clocksignal with the oscilloscope?
Can you also include a Pin or LED in the Irq and test with oscilloscope if there is always an Irq?
And if all of this not help trie to use in softwaremode an another pin just for the clock to test it with the oscilloscope
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
Re: 도와주세요! (PIC18F47Q10_I2C)
The program has been modified again. The timer interrupt works fine.
- Attachments
-
- I2C_MCP3421_Test.fcfx
- (27.35 KiB) Downloaded 203 times
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
-
- Posts: 367
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 63 times
- Contact:
Re: Please Help Me!!(PIC18F47Q10_I2C)
One more question.
FC8 shows warning.
I am not sure how important it is, but in case:
- what about missing variables in your program?
FC8 shows warning.
I am not sure how important it is, but in case:
- what about missing variables in your program?
- Attachments
-
- MissingVariables-1.jpg (28.11 KiB) Viewed 8495 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Please Help Me!!(PIC18F47Q10_I2C)
That would happen for three reasons.
1)Added assigned a new variable, added it to simulator debugger, then deleted variable from flowchart.
2) Renamed a variable.
3) Added a local variable and no longer within the macro where variable is used.
Its not whats happened in your case as missing variables were global.
1)Added assigned a new variable, added it to simulator debugger, then deleted variable from flowchart.
2) Renamed a variable.
3) Added a local variable and no longer within the macro where variable is used.
Its not whats happened in your case as missing variables were global.
Martin
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
Re: Please Help Me!!(PIC18F47Q10_I2C)
With your help, I2C works fine. Thank you.
However, when reading in 16bit, the first byte comes in and the second byte is fixed at 255. I upload my modified program.
Thanks for your help.
However, when reading in 16bit, the first byte comes in and the second byte is fixed at 255. I upload my modified program.
Thanks for your help.
- Attachments
-
- I2C_MCP3421_Test2.fcfx
- (17.42 KiB) Downloaded 124 times
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
Re: Please Help Me!!(PIC18F47Q10_I2C)
I think I am wrong. So, I modified the program using another MCU (PIC18F26K22) and another ADC (MCP3428).
But the result is not good. The first byte value comes in. However, only the value "255" comes in the second byte.
Pullup = 4.7KOhm
Somebody ask for advice.
But the result is not good. The first byte value comes in. However, only the value "255" comes in the second byte.
Pullup = 4.7KOhm
Somebody ask for advice.
- Attachments
-
- I2C_MCP3428_18F26K22.fcfx
- (17.92 KiB) Downloaded 145 times
-
- Valued Contributor
- Posts: 1208
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
Re: Please Help Me!!(PIC18F47Q10_I2C)
When you receive the data you have ReceiveByte(1) for the first data byte. The 1 (or true?) indicates 'last byte' - try using first = ReceiveByte(0) second = ReceiveByte(1).
Martin
Martin
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
Re: Please Help Me!!(PIC18F47Q10_I2C)
It's Solved.
Thank you very much MARTIN.
I post programs for others.
But there are some problems. Values are well read. However, the values measured and measured with an actual multimeter are different.
Using a 10Kohm volume, low voltage was applied to both sides, and the voltage drawn from the middle tap was applied.
If someone knows the cause, I would appreciate any advice.
Thank you to everyone who helped.
Thank you very much MARTIN.
I post programs for others.
But there are some problems. Values are well read. However, the values measured and measured with an actual multimeter are different.
Using a 10Kohm volume, low voltage was applied to both sides, and the voltage drawn from the middle tap was applied.
If someone knows the cause, I would appreciate any advice.
Thank you to everyone who helped.
- Attachments
-
- I2C_MCP3428_18F26K22.fcfx
- (18.62 KiB) Downloaded 134 times