Difficulty with 28X2 and i2C

AlastairD(Aus)

New Member
Hi all - just joined the Picaxe forum.

I used to work with electronics all the time but for the last 10 years have done zilch. Now I am retired I am building lots of things for various projects and have adopted the Picaxe as my system and finding it good fun.

I have built and got running a a sampling and display system for temps & voltages in the motorhome I am building. I did this with an 18M2 and an i2c LCD display. All good but I needed more sampling channels and decided to move up to a 28X2. After the necessary changes the code works and the sensor channels are ok. My problem is the i2c communication. I have the correct pins connected, the resistor pull ups ok but it does not work. I can plug in the 18M2 on the breadboard and talk to the display on the i2c bus with no changes and it works.

After reading everything relevant and trying everything I can think of I am fed up. What have I missed? What should I try?

cheers

:confused:
 

darb1972

Senior Member
AlastairD(Aus):247800 said:
Now I am retired I am building lots of things for various projects and have adopted the Picaxe as my system and finding it good fun.
I'm jealous! Retired with PICAXE play time. What more could one want?

Welcome to the Forum. Please post your code so the folks here can check it for any supple differences needed for changing to a 28X2. At a guess it might be a matter of speed/baud rates and the changes needed might only be very minor.
 

AlastairD(Aus)

New Member
Darb,

well here is some code that runs on the 18M2 but fails on the 28X2. I have no problem with getting the X2 to do non i2C things

#picaxe 28x2


;let dirsB = %11111111
;let adcsetup = 0

start0:
setfreq m4
hi2csetup i2cmaster, $C6,i2cslow,i2cbyte ;LCD05 @ adr $C6
; hi2csetup i2cmaster, $C6,i2cfast,i2cbyte ;LCD05 @ adr $C6
; hi2csetup i2cmaster, $C6,i2cslow_8,i2cbyte ;LCD05 @ adr $C6
hi2cout 0,(12) ;clr scrn
hi2cout 0,(3,4,1,"slave test 28X2") ;y,x cursor & txt
hi2cin 0,(b0) ;read fifo
hi2cin 3,(b1) ;read version

main:
debug
high b.7
pause 500
low b.7
goto main


I have tried every combination of speed etc but the display remains unimpressed. The values returned from the display are invalid.

I am sure it is some quirk of the X2 but before posting I have read and tried everything I can think of.

28X2 &i2C experts - help!
 

g6ejd

Senior Member
Check your hardware port mapping and pins...between the two devices that is most likely where your problem is.
 

Technical

Technical Support
Staff member
A 28X2 default speed is 8MHz. So if you slow it down to 4 you must use i2cslow_4 to match
 

darb1972

Senior Member
Sorry, I have been on a flight and couldn't respond. I'm no expert myself (still on a steep learning curve), however it looks like the pros have come to the rescue. I think Technical has hit the nail on the head with i2c speed matching that of your clock speed.

Let us know how you go with the changes to your code.
 

Bill.b

Senior Member
I am another retired ex electronic engineer playing with picaxe.


Are you using the AXE 033 display, if so
then correct syntax for communicating is
Code:
hi2csetup i2cmaster, $c6,i2cslow,i2cbyte
hi2cout 0,(254,1,255)		'Clear display ( not always required)
Pause 10
hi2cout 0,(254,128,255)         'set cursor at start of line one or (254,192,255) will set curser to start of line 2
pause 10
hi2cout 0,(" slave test 28X2",255)          ' Message to be displayed
the PIC chip requires the 255 terminator.

Bill
 
Last edited:

AlastairD(Aus)

New Member
Well I thought I had better do the right thing and tell what the problem was.

After trying everything I could think of I sent an email to tech support at Picaxe. Very quick response from John there.

I had not appreciated that on the AXE091 development board that pins 11 - 14 on the 28X2 do not come out to the 40 pin headers like all the others but come out on a separate 4 pin header. No reason given but now all works. All part of the learning curve !!

Now back to the real task of building the project.

cheers
 

srnet

Senior Member
One thing I would recommend, is that if things dont work as expected, remove the power from your project and test all the connections with a multimeter\continuity tester.

The connections you think you have made on the circuit diagram, are there in reality ?

It does not take long, and is quicker than contacting support too.
 

Technical

Technical Support
Staff member
I had not appreciated that on the AXE091 development board that pins 11 - 14 on the 28X2 do not come out to the 40 pin headers like all the others but come out on a separate 4 pin header. No reason given but now all works. All part of the learning curve !!
Pins 8-14 cannot be shared between the 28/40 pin layouts because of the different pinouts (resonator /power connections etc.)
It is not just the 4 way header, some of the 10 way header are different as well.


Use the outer left hand row for 40 pin circuits.
Use the second row for 28 pin circuits.
 
Top