returning user need help: Picaxe28x :: i2c

Klausw

New Member
The following programm I wrote in 2004
2 days ago, I wanted to get this running for an identical application, have one single error and can't fix it.

Code:
.
.
	;********************  P3
	;EmitterOn
	let pins = 3
 	pause EmitterOnDelay
	;read real Platine3						;Adr "4" = Dip-Switch on Board / 2
	let MultiPlexCompleteAdress = %100 + %01000001		;First 8 of this Board ; NB last Bit is ReadNotWrite
	i2cslave MultiPlexCompleteAdress, i2cslow, i2cbyte	;set multiplexer slave adress
	readi2c 0,(b4)							
	let MultiPlexCompleteAdress = %100 + %01110001 		;Second 8 of this Board  ; NB last Bit is ReadNotWrite
	i2cslave MultiPlexCompleteAdress, i2cslow, i2cbyte	;set multiplexer slave adress
	readi2c 0,(b5)							
.
.
	;**********  ser out
	;EmitterOff
	let pins = 0
	sertxd(%01010101,%01010101,IEncoder,b0,b1,b2,b3,b4,b5,b6,b7)
.
.
The application: Scanner-bar
I have 1 main board hosting the picaxe28x
1 have 8 identical slave boards used for Emmiting Light
1 have 8 identical slave board used as receiver (each hosting one PCF8547P + one PCF8547AP)

the part where i am stuck is:
half receiver board number 3 refuses to work
Code:
let MultiPlexCompleteAdress = %100 + %01110001 		
i2cslave MultiPlexCompleteAdress, i2cslow, i2cbyte		
readi2c 0,(b5)
for debugging I tried the following:
Excanged the receiver board completely with a new one
swapped 2 receiver boards
excanged the cables
excanged the main board
using b8 to store the value instead of b5


whatever i tried, the PCF8547AP on the adress %100 + %01110001 does not respond (value remains 0, I would expect 255/%11111111)

all the other 15 PCF8547P/PCF8547AP are working well

in 2004 i used the Programming Editor 4.x, I cant install this, I get an exception during Installation.
So I downloaded the actual version 5.1.6 and I am using this one.

The picaxes I am using I took out of our stock, they have been bought in 2004, the firmware reports 7.6.

My doubts are the following:

Maybe in 2004 when programming, there I made somthing out of specs, but I got away with it and everything went well.

The newer Program Editor maybe does everything "closer" as intended which leads, that my Error from the past now doesn't get through.


As all hardware involved is already changed, I feel there must be something wrong with the code.

Anyone using i2c maybe can find dubios lines in my code?
Anything I could try to change to pin the problem?
 
Last edited:

Klausw

New Member
Further tests I executed til now:

Changed PC, used another PC and installed even the Programming Software Version 4 from 2004. Nothing changed.

Another Test I did right now:

I swapped the sequence of the order of Board-Adressing.

Now the physical Board number one is adressed with "MultiPlexCompleteAdress = 4 + %01110001" (I swapped the DIP-switch adressing on Board 1 and Board 3).
Now the physical Board 1 is behaving like primary the Board 3.
b0 contains the valid value, b1 remains 0.

Should this be prove enought, that the hardware may not be the source of the error?
 
Last edited:

Klausw

New Member
Detached all bords but one, and then the "non working" address did work.
Finally found out that the "dip-switch" on board no 5 wasn't working correct, causing double adressing, which in result caused sort of collission on the i2c bus.

Conclusion:
Think better about how to debug next time, will save you nerves and time ;)
 
Top