WRITE A PROGRAM TO DO A COMUNICATION ,USING I2C BUS AND 2 PIC16F876..
THE SLAVE USE ASSEMBLER,AND I THINK IS O.K.
THE MASTER USE PICBASICPRO,AND CAN'T RECEIVE THE DATA.
I USE THIS CONFIGURATION:
DEFINE HSER_BAUD 19200
DEFINE I2C_SLOW 1
DEFINE ONINT_USED 1 ' BOOTLOADER
SCL VAR PORTC.3 ' Clock pin
SDA VAR PORTC.4 ' Data pin
FromSlave VAR BYTE 'dati arrivati dallo Slave
Letture VAR BYTE ' Dati letti da ADC (funzione non implementata)
Test VAR PORTA.0
SSPCON= %00101000 ' Setta il dispositivo in Master Mode
SSPADD= %00001001 ' 100KHz con Fosc 4MHz
PORTA= 0
TRISA= %11111110
PORTB=0
TRISB=0
PORTC=0
TRISC=%10111111
FromSlave=0
CICLO:
I2CRead SDA,SCL,2,[FromSlave],ERRORE
GoTo CICLO
some opinion??
thaks to all
THE SLAVE USE ASSEMBLER,AND I THINK IS O.K.
THE MASTER USE PICBASICPRO,AND CAN'T RECEIVE THE DATA.
I USE THIS CONFIGURATION:
DEFINE HSER_BAUD 19200
DEFINE I2C_SLOW 1
DEFINE ONINT_USED 1 ' BOOTLOADER
SCL VAR PORTC.3 ' Clock pin
SDA VAR PORTC.4 ' Data pin
FromSlave VAR BYTE 'dati arrivati dallo Slave
Letture VAR BYTE ' Dati letti da ADC (funzione non implementata)
Test VAR PORTA.0
SSPCON= %00101000 ' Setta il dispositivo in Master Mode
SSPADD= %00001001 ' 100KHz con Fosc 4MHz
PORTA= 0
TRISA= %11111110
PORTB=0
TRISB=0
PORTC=0
TRISC=%10111111
FromSlave=0
CICLO:
I2CRead SDA,SCL,2,[FromSlave],ERRORE
GoTo CICLO
some opinion??
thaks to all