hello,
I am trying to transfer data from one Pic16F88 to another F88 chip. is there a method better then the other one. I only have 4 ports left (one is use for adcin, one for ground between the two chips and two for serin and serout). The only alternative I know but would cost a bit more is to use an external EEPROM..
I have A master program and a Slave program, here is the code, I think it is self explanatory:
PortB.7 is hooked up to the PortB.0 (interrupt) of the other chip
Master:Slave:Code:SetRTCTime = 125 ViewTime = 0 I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl] Pause 30 serout portb.7, n2400, [$55, $55, $55, $55, $aa, SetRTCTime, ViewTime, StartTimeHour ] serout portb.7, n2400, [StopTimeHour, StartTimeMin, StopTimeMin, RTCYear, RTCMonth, RTCDay, RTCHour, RTCMin ] Pause 100 lcdout $FE,1, "upload Time Int" lcdout $FE,$C0, "Completed" pause 1500 ReturnThe problem now is that the information is not transfering. And this is not a method to get a ACK and verify information transfered.Code:'///////////////////////////// '/////// MyInterrupt //////// '///////////////////////////// DISABLE MyInterrupt: waitfor55: serin portb.0 , n2400 , temp : if temp <> $55 then goto waitfor55 waitforaa: serin portb.0 , n2400 , temp : if temp <> $aa then goto waitforaa serin portb.0, n2400, SetRTCTime : serin portb.2, n2400, ViewRTCTime serin portb.0, n2400, StartTimeHour : serin portb.2, n2400, StopTimeHour serin portb.0, n2400, StartTimeMin : serin portb.2, n2400,StopTimeMin serin portb.0, n2400, Year : serin portb.2, n2400, Month serin portb.0, n2400, Day : serin portb.2, n2400, Hour serin portb.0, n2400, Minute If (SetRTCtime = 125) then I2CWRITE SDApin,SCLpin,$D0,$00,[$00,Minute,Hour,$00,Day,Month,Year,$00] ' Write to DS1307 to initialize a new time pause 30 Endif If (ViewRTCTime = 55) then I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl] Pause 30 serout portb.7, n2400, [$55, $55, $55, $55, $aa, SetRTCTime, ViewTime ] 'if 222 then pause 200 serout portb.7, n2400, [$55,$55,$55,$55,$55,$aa,RTCYear, RTCMonth, RTCDay, RTCHour, RTCMin, RTCSec] serout portb.7, n2400, [StartTimeHour, StopTimeHour, StartTimeMin, StopTimeMin] pause 100 Endif INTCON.1 = 0 ' Enable external Interrupt RESUME ENABLE ' Enable Interrupt




Bookmarks