Jump to content
Sign in to follow this  
Joan

Using of I²C Protocol

Recommended Posts

Hi All:

I have a question ... I need to implement an I²C with a 12F629, is it possible? I've seen the project wizard and there is some parameters but not for 12F629 ... The functions that create project wizard, which I²C BW generate for an internal 12F629 Clk of 4MHz? A minimum of 100k?

 

It is possible to implement I²C comunication into 12F629 at the same time it's controlling 2 sotfware PWM's? Is PWM consistent?

 

Regards;

 

John

Edited by Joan
Delete personal data

Share this post


Link to post
Share on other sites
Guest David

Hi Joan,

 

The 12F629 has no hardware support for I²C like the PIC16F876, 16F877 has.

Never tried it with the 12F629 but you can implement I²C with software like the sample that is included into the Picant compiler.

 

I don’t think that the I²C will slow down the software generated PWM because I²C can run on 100khz, 400khz or slower, but I don’t have experience with that so you have to try it.

 

Regards,

David

Share this post


Link to post
Share on other sites

Hi Dave:

I've tryed with the sample code located at the directory

 

C:/.../plugin_examples/bcd_i2c/

 

And I had and error when building project (Target=16F877 & Clk=4Mhz) like this:

 

EPOMA~1.C

i2cmain.c

line 84: EOF in comment

 

1 errors detected

Prepocessor error

Done

 

Failed

 

I don't have any idea abut that, Do you know?

 

Thanks

 

John B)

Edited by Joan
Delete personal data

Share this post


Link to post
Share on other sites

Solved problem. Changed lines

 

/* The following line used to display in BCD */

PORTB=char_to_bcd(RetrieveData( 0x50, 0, ( num - 1 ))); /* Reads back to port B in BCD*/

/* The following line used to display in hex */

/* PORTB=RetrieveData( 0x50, 0, ( num - 1 )); /* Reads back to port B in hexadecimal*/

 

 

for this

 

/* The following line used to display in BCD */

PORTB=char_to_bcd(RetrieveData( 0x50, 0, ( num - 1 ))); /*Reads back to port B in BCD*/

/* The following line used to display in hex */

/*PORTB=RetrieveData( 0x50, 0, ( num - 1 )); Reads back to port B in hexadecimal*/

 

There is a fxxkin'  "/*" ....

B)

 

Bye ....

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...