MikeBZH, Its in the manual.... And there is no difference whether its for an 16 series or 18 series..
Dave Purola,
N8NTA
MikeBZH, Its in the manual.... And there is no difference whether its for an 16 series or 18 series..
Dave Purola,
N8NTA
I use both I2CRead and I2CWrite with pic18F4680 without any problem.
In my code I use always the following two declarations:
DEFINE I2C_SLOW 1
DEFINE I2C_HOLD 1
Al.
All progress began with an idea
Dave, Aratti
So it is so simple ?
I'll try this tomorrow.
Many thanks for your help
MikeBZH (also F8DFN, 73's Dave)
Good evening !
No way with this problem !
I have spent the whole day on it with no result...
The circuit is yet very simplified : only the 18F2685 + the MAX517 + 2 pull-up resistors. The PIC is running at 32 MHz.
The program is also very simple and starts with :
DEFINE I2C_SLOW 1
DEFINE I2C_HOLD 1
....
AppGain:
Gain = $55
RESET517 = $10
CTRL517 = $00
Re2 : I2CWRITE PORTC.4,PORTC.3,CTRL517,ADR517,[Gain],Re1
PAUSE 10
GOTO Re3
Re1: ADR517 = ADR517 + 1
if (ADR517 <> $FF) then
goto Re2
else
endif
Re3: RETURN
All the variables are bytes.
AppGain is called by a test section of my program.
The hereabove version was adapted to scan the addresses in search of a response from the MAX517. According to the manual, the program jumps to Re1 if no ACK was received from the slave. And there is never any ACK received, the program always ends with $FF in ADR517. The slave address should be $2c but I got no answer from there.
I have checked the SDA and SCL lines with my scope. The signals look fine but no ACK is visible. I have even changed the MAX517 for a new one : same behaviour.
Any idea ?
MikeBZH
MikeBZH, What values are you using for the pullup reststors on the SDA/SCL lines... I have found in the past that 4.7 k resistors are too large and slow the current flow for passive pullup when I use more than 4 devices on a bus... I would use 2.2 k resistors and try that.. It should cleanup the data signal a bit.. I'm not sure if the statement DEFINE I2C_HOLD 1 is required or not.. I have never used it in the past and I have used 100 khz. parts and 400 khz. parts with no issues.. Just make sure you use the statement DEFINE I2C_SLOW 1 if the part is only good for 100 khz. and you are running the processor at more than 4 mhz..
Dave Purola,
N8NTA
Hi,
I fixed it, but the result is very strange.
Resistors values or Defines have no influence but it seems that there is bug in the PBP documentation (or in the compiler, as you prefer).
I found that the instruction :
I2CWRITE DataPin, ClockPin, Control, [Address,] ...
should be written
I2CWRITE DataPin, ClockPin, [Address,] Control...
In other words everything works if one pass first the Address and then the Control instead of what is written in the documentation. This is very clear with a dual trace scope on SDA and SCL.
My compiler version is 2.50L
MikeBZH / F8DFN
Moreover,
The physical address has to be shifted left once (multiplied by 2) to cope with the I2C format. In my case the physical address is $2C : I have to pass $58 to I2CWRITE.
MikeBZH / F8DFN
Bookmarks