CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC16F690 I2C and compiler versions

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nmeyer



Joined: 09 Jul 2004
Posts: 70

View user's profile Send private message

PIC16F690 I2C and compiler versions
PostPosted: Tue Dec 15, 2009 10:31 am     Reply with quote

I have a project where I am using the I2C of the PIC16F690 using
Code:

#use i2c(SLAVE,FORCE_HW,fast,sda=PIN_B4,scl=PIN_B6,address=0x12,RESTART_WDT,stream=ex)

for my I2C. I worked on the project about 2 years ago and I had an I2C host device that I used to test the code. It all appeared to work well. Now some issues have come up and I am trying to debug the project. But now I can not get any of communications happening with any new program I compile. If I load an old hex file into the PIC and run it, it will communicate fine. If I take that same code and recompile it and make no other changes, it won't communicate. I have tried different versions of compiler but that does not seem to make a differece. The code that I know worked was done on V4.060 and I do not have a copy of that. I have V4.058 and V4.062 and some V4.08x's. Does anyone have a thought of why this might be happening?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Dec 15, 2009 12:19 pm     Reply with quote

My guess is that you're probably not using the same source code
as was used to create the original .HEX file.

Did you keep the original .LST file, compiled with vs. 4.060 ?
nmeyer



Joined: 09 Jul 2004
Posts: 70

View user's profile Send private message

PostPosted: Tue Dec 15, 2009 12:44 pm     Reply with quote

I have looked at this and it is the same source code. I found that it was compiler V4.062 that I made the original files in and I do have that version. So I have recompiled the program and performed a file compare of the lst files and found this difference:
Code:

.................... ////////////////////////////////////////////////////////////////////////////////
  .................... #INT_SSP
  .................... void ssp_interupt (void)               //detect external smbus activity
  .................... {
  ....................    BYTE incoming, state;
  ....................
  ....................    state = i2c_isr_state();
  *
D <! 0044:  BSF    03.5
  0045:  BTFSC  14.5
  0046:  GOTO   04C
D <! 0047:  BCF    03.5
  0048:  CLRF   67
  0049:  BTFSC  13.0
  004A:  BSF    67.7
D <! 004B:  BSF    03.5
D <! 004C:  BCF    03.5
  004D:  MOVF   67,W
  004E:  INCF   67,F
  004F:  MOVWF  6F
  *
  05A4:  MOVLW  03
  05A5:  MOVWF  67
  ....................    if(state < 0x80)                     //Master is sending data
  *

with the D<! being in the original list file but not the newly compiled list file. This is the only difference I find in list files. Being that it is in the Int_ssp code, I am sure that it is what is causing the issue, but I do not know what it means, or why there is the difference between the two list files.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Dec 15, 2009 12:56 pm     Reply with quote

Quote:
with the D<! being in the original list file but not the newly compiled list file

I made a little test program and compiled it with vs. 4.062.

The .LST file does have all the Bank Select lines that you say your
newly compiled (with 4.062) code doesn't have. In other words, I am
able to duplicate your "original" code that has the bank select lines.

Compile the test program shown at the end of this post. See if you
get the same code as shown in the .LST file below.
Code:
.................... void ssp_isr(void)
.................... {
.................... int8 state;
.................... 
.................... state = i2c_isr_state();
0037:  BSF    03.5
0038:  BTFSC  14.5
0039:  GOTO   03F
003A:  BCF    03.5
003B:  CLRF   2E
003C:  BTFSC  13.0
003D:  BSF    2E.7
003E:  BSF    03.5
003F:  BCF    03.5
0040:  MOVF   2E,W
0041:  INCF   2E,F
0042:  MOVWF  2F
*
0068:  MOVLW  03
0069:  MOVWF  2E


Here's the test program:
Code:

#include <16F690.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

//#use i2c(SLAVE, SDA=PIN_C4, SCL=PIN_C3, address=0xa0)
#use i2c(SLAVE,FORCE_HW,fast,sda=PIN_B4,scl=PIN_B6,address=0x12,RESTART_WDT,stream=ex)

#INT_SSP
void ssp_isr(void)
{
int8 state;

state = i2c_isr_state();
}

//===============================
void main ()
{

while(1);
}
nmeyer



Joined: 09 Jul 2004
Posts: 70

View user's profile Send private message

PostPosted: Tue Dec 15, 2009 1:07 pm     Reply with quote

yes, i do get the same thing
Code:

.................... void ssp_isr(void) 
.................... { 
.................... int8 state; 
.................... 
.................... state = i2c_isr_state(); 
0037:  BSF    03.5
0038:  BTFSC  14.5
0039:  GOTO   03F
003A:  BCF    03.5
003B:  CLRF   2E
003C:  BTFSC  13.0
003D:  BSF    2E.7
003E:  BSF    03.5
003F:  BCF    03.5
0040:  MOVF   2E,W
0041:  INCF   2E,F
0042:  MOVWF  2F
*
0068:  MOVLW  03
0069:  MOVWF  2E

But this is the section out of the recompiled V4.062 code and they are not there

Code:

.................... void ssp_interupt (void)               //detect external smbus activity
.................... {
....................    BYTE incoming, state;
.................... 
....................    state = i2c_isr_state();
*
0044:  BTFSC  00.5
0045:  GOTO   049
0046:  CLRF   67
0047:  BTFSC  00.0
0048:  BSF    67.7
0049:  MOVF   67,W
004A:  INCF   67,F
004B:  MOVWF  6F
*
05A0:  MOVLW  03
05A1:  MOVWF  67
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Dec 15, 2009 1:15 pm     Reply with quote

You have some weird stuff there, where it's testing registers "00" instead
of the correct register addresses.

I would say, re-install the compiler.
nmeyer



Joined: 09 Jul 2004
Posts: 70

View user's profile Send private message

PostPosted: Tue Dec 15, 2009 2:50 pm     Reply with quote

I am not sure what is going on. I have three different computers one with V4.062, one with V4.086 and another with V4.093. The one with V4.093 compiles it correctly and gives a good work file. No matter what I put on the other two, I always get the bad list file.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group