mrx23
- 26th November 2006, 17:48
I want to communicate with MAX7311 port extender.
It has 16 I/O ports. Its uses I2C (max 400 Kbit\s)
http://datasheets.maxim-ic.com/en/ds/MAX7311.pdf
The I2C master is PIC16F628A @ 20Mhz with software I2C.
The job:
TX: Read out the 1st MAX7311 16input ports, transmit to the receiver side with RS232.
RX: receive the message with the 2nd, write the 16bits to the 2nd MAX7311 outputs.
The inteface between the 2 PIC is NOT a problem.
Just the software interface between PIC-MAX7311.
There is the TX side on the picture.
http://kepfeltoltes.eof.hu/files/83_431164563466.png
The extenders I2C address is: 0x40 (64 dec).
CLK:PB3, DATA:PB2
'-----------
switch VAR byte[2]
I2Cread PORTB.2,PORTB.3,0,64,switch[0],switch[1]
'Control=0, Adr=64, store received 2 bytes in switch
'-----------
switch VAR byte[2]
I2Cwrite PORTB.2,PORTB.3,0,64,switch[0],switch[1]
'Control=0, Adr=64, set
'-----------
Is this going to work?
START, STOP, and acknowledge bits are automatical controlled by I2Cwrite/read command?
How do I set the 2nd MAX7311's Port1/Port2 registers to output?
Thank you!
It has 16 I/O ports. Its uses I2C (max 400 Kbit\s)
http://datasheets.maxim-ic.com/en/ds/MAX7311.pdf
The I2C master is PIC16F628A @ 20Mhz with software I2C.
The job:
TX: Read out the 1st MAX7311 16input ports, transmit to the receiver side with RS232.
RX: receive the message with the 2nd, write the 16bits to the 2nd MAX7311 outputs.
The inteface between the 2 PIC is NOT a problem.
Just the software interface between PIC-MAX7311.
There is the TX side on the picture.
http://kepfeltoltes.eof.hu/files/83_431164563466.png
The extenders I2C address is: 0x40 (64 dec).
CLK:PB3, DATA:PB2
'-----------
switch VAR byte[2]
I2Cread PORTB.2,PORTB.3,0,64,switch[0],switch[1]
'Control=0, Adr=64, store received 2 bytes in switch
'-----------
switch VAR byte[2]
I2Cwrite PORTB.2,PORTB.3,0,64,switch[0],switch[1]
'Control=0, Adr=64, set
'-----------
Is this going to work?
START, STOP, and acknowledge bits are automatical controlled by I2Cwrite/read command?
How do I set the 2nd MAX7311's Port1/Port2 registers to output?
Thank you!