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

Problems with I2C on dsPIC30F6015

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



Joined: 03 Aug 2018
Posts: 11

View user's profile Send private message

Problems with I2C on dsPIC30F6015
PostPosted: Tue Aug 21, 2018 3:37 am     Reply with quote

Hello,

I got problems to send messages via I2C of the dsPIC30F6015.
I just want to get a really simple program to work.
Code:

#use i2c(master,I2C1,stream=I2C_NFC)

...

while(1)
{
   i2c_start(I2C_NFC);
   i2c_write(I2C_NFC, 0xFF);
   i2c_stop(I2C_NFC);
   delay_ms(100);
}



The program is just a test program.
The compiler says """Error 12... Unknown identifier: I2C_NFC

I think is a small syntax-error.

Thanks in advance.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Aug 21, 2018 4:15 am     Reply with quote

First question. What compiler version?. On very old compilers I2C streams didn't exist.
However assuming something from the last few years, what you post works:
Code:

#include <30F6015.h>
#device ICSP=1
#use delay(crystal=20000000)

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES CKSFSM                   //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES NOBROWNOUT               //No brownout reset

#use i2c(master,I2C1,stream=I2C_NFC)

void main()
{
   while(TRUE)
   {
      i2c_start(I2C_NFC);
      i2c_write(I2C_NFC, 0xFF);
      i2c_stop(I2C_NFC);
      delay_ms(100);
   }
}

Compiles fine.

One thing that can happen, is a 'hidden' character. If you have typed a non displayable character in one of the I2C_NFC parts, then this would be the complaint you would get.
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