ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 12.06.2025
Просмотров: 8178
Скачиваний: 1
© MCS Electronics, 1995-2007
End Sub
'when you want to control a chip with a larger memory like the 24c64 it requires an additional byte
'to be sent (consult the datasheet):
'Wires from the I2C address that are not connected will default to 0 in most cases!
' |
I2cstart |
'start condition |
' |
I2cwbyte &B1010_0000 |
'slave address |
' |
I2cwbyte H |
'high address |
' |
I2cwbyte L |
'low address |
' |
I2cwbyte Value |
'value to write |
' |
I2cstop |
'stop condition |
'Waitms 10
CONFIG I2CSLAVE
Action
Configures the I2C slave mode.
Syntax
CONFIG I2CSLAVE = address , INT = interrupt , TIMER = tmr
Remarks
Address |
The slave address you want to assign to the I2C slave chip. This is |
an address that must be even like 60. So 61 cannot be used. |
|
Interrupt |
The interrupt that must be used. This is INT0 by default. |
Tmr |
The timer that must be used. This is TIMER0 by default. |
While the interrupt can be specified, you need to change the library code when you use a non-default interrupt. For example when you like to use INT1 instead of the default INT0.
The same applies to the TIMER. You need to change the library when you like to use another timer.
See Also
CONFIG TWI
Example
'----------------------------------------------------------------------------- |
|
------------ |
: i2c_pcf8574.bas |
'name |
|
'copyright |
: (c) 1995-2005, MCS Electronics |
'purpose |
: shows how you could use the I2C slave library to |
create a PCF8574 |
: AT90S2313 |
'micro |
|
'suited for demo |
: NO, ADDON NEEDED |
'commercial addon needed |
: yes |
'-----------------------------------------------------------------------------
------------
$regfile = "2313def.dat" |
' specify the used |
page -341- |