View previous topic :: View next topic |
Author |
Message |
ncmain
Joined: 24 Jul 2004 Posts: 5 Location: Wroclaw
|
Posted: Tue Jun 06, 2006 8:31 am Post subject: problem with I2C |
|
|
Hello
i'm using I2C and everything works, when I turn on External Access I2C stop working. I try increase stack size and nothing.
i use easyTCP board (tcp works), i want to expand port with PCF8574.
web and pcf works separately, together no
greets
NCMain |
|
Back to top |
|
|
bfdegraaff
Joined: 15 Nov 2005 Posts: 72 Location: Brazil
|
Posted: Tue Jun 06, 2006 9:07 am Post subject: |
|
|
Dear ncmain,
You will have to post some code, otherwise we can't help you,
Regards Barry de Graaff _________________ ______
Barry de Graaff is a micro electronics student,
formerly on work emplacement at MCS Electronics.
www.barrydegraaff.tk/edb |
|
Back to top |
|
|
ncmain
Joined: 24 Jul 2004 Posts: 5 Location: Wroclaw
|
Posted: Tue Jun 06, 2006 9:19 am Post subject: code :) |
|
|
ok, a wrote code same as below and it works, when i turn on External Access w Compiler options this code not work. Why ??
------------------------------------------
$regfile = "m162def.dat"
$crystal = 8000000
Const Adres_8574 = 65 ' adress 8574
Config Lcdbus = 4
Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3 , E = Portb.4 , Rs = Portb.5
Config Lcdmode = Port
Config Lcd = 16 * 2
Config Sda = Portd.5
Config Scl = Portd.6
Config I2cdelay = 10
I2cinit
Dim Stan As Byte
Dim Stan_pop As Byte
Dim B1z As Word
Dim B1o As Word
Dim B2z As Word
Dim B2o As Word
Dim Blad As Bit
Stan_pop = 0
Cls
Home
Lcd "Start"
Wait 2
Do
Blad = 0
I2cstart
I2cwbyte Adres_8574
If Err = 1 Then Blad = 1
I2crbyte Stan , Ack
I2cstop
If Stan <> Stan_pop Then
Stan_pop = Stan
Stan = Not Stan
Select Case Stan
Case 15:
B1o = B1o + 1
Case 78:
B1z = B1z + 1
Case 46:
B2o = B2o + 1
Case 30:
B2z = B2z + 1
Case 47:
B2o = B2o + 1
B1o = B1o + 1
Case 31:
B1o = B1o + 1
B2z = B2z + 1
Case 110:
B1z = B1z + 1
B2o = B2o + 1
Case 94
B1z = B1z + 1
B2z = B2z + 1
End Select
Home
Lcd "B1=" ; B1o
Lowerline
Lcd "B2=" ; B2o
End If
waitms 100
Loop
end 'code |
|
Back to top |
|
|
bfdegraaff
Joined: 15 Nov 2005 Posts: 72 Location: Brazil
|
Posted: Tue Jun 06, 2006 12:21 pm Post subject: |
|
|
Dear ncmain,
This is very logical if you switch on the external access the
compiler conigures your ATMega for use with an external
memory.
The external memory interface uses:
• AD7:0: Multiplexed low-order address bus and data bus
• A15:8: High-order address bus (configurable number of bits)
• ALE: Address latch enable
• RD: Read strobe.
• WR: Write strobe.
So you can NOT use RW and RD (PD6,7) for I2C if you enable external
access.
I suggest you use another pin (Pb0.1 or something.)
Regards Barry de Graaff _________________ ______
Barry de Graaff is a micro electronics student,
formerly on work emplacement at MCS Electronics.
www.barrydegraaff.tk/edb |
|
Back to top |
|
|
ncmain
Joined: 24 Jul 2004 Posts: 5 Location: Wroclaw
|
Posted: Tue Jun 06, 2006 2:19 pm Post subject: ofcourse. |
|
|
helo
absolutely! ... i'm stupid
THanx
greet |
|
Back to top |
|
|
|