I am using 2 16F887a's to communicate data via RS485 in an ROV project. Sending data from the ROV to the surface works fine, but I can't get the ROV to recieve data for the light switch command (I know the comm's are working because I am using a Pololu servo controller to operate the thrusters). Can some one tell me what is wrong with the following code? The processor hangs striaght after the I2C command.
Light_pos =0
Main:
i2cread SDA,SCL,$C0,2,[bearing.Highbyte,bearing.lowbyte] 'get data from the compass
lcdout $fe, 1,"Heading ",DEC BEARING/10,223
SEROUT PORTC.6,T9600,["H",bearing.Highbyte,bearing.lowbyte] 'transmit compass data to the surface
Serin PORTC.7,T9600,200,read_adc,["L"],Light_val ' test for light status from the surface
read_adc:
ADCIN 0,AD0 ' read AD's for temp, gyro and pressure
AD0 = (AD0*10)/quanta
LCDOUT $fe, $C0
LCDOUT DEC AD0
AD0=0
Bookmarks