I2C Primer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I2C Primer

1,009 Views
ronaldpatton
Contributor I

Hi,

(I am reposting this in a different area.  I am learning these forums).

 

Hi,

 

I am brand new to the Freescale product suite and Code Warrior.  I have inherited a project and the associated device which is a amateur radio device.  The device has several components, 1) MC9S08QG8CPBE, 2) A MCP3422 ADC and a KTM-s1201.  At any rate, the MCU communicates with the ADC via I2C.

 

If someone would be so kind as to point me in the right direction to Freescale I2c primer, I would be most appreciative.

 

The I2C source code included with the project is dated 8/2008.  This is pretty much a "down on the metal" type program.  Does Freescale have an I2C library I may link to?

 

//===================================================================
// MC9RS08KA8 IIC Subroutines  8/24/2008
// Written by John H. Fisher - K5JHF
//===================================================================

#include "derivative.h"
#include "iic.h"

//===================================================================

void i2c_send ( char send ) {

  IICD  = send; // master transmit;

  while (!IICS_IICIF);   // wait until IBIF;

  IICS_IICIF = 1; // clear the interrupt event flag;

}

 

//===================================================================

 

Thanks,

73,

Ron / W4MMP

Labels (1)
0 Kudos
Reply
5 Replies

827 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ron,

Which version of CW do you use ?  You can use the Processor Expert on CW , it provides I2C driver.

For example CW10.6,  when you create project , please select "Processor Expert"

pastedImage_0.png

then add the SW_I2C component

pastedImage_1.png

then you can refer to the "Typical Usage" to configure , there have the I2C demo :

pastedImage_2.png

Hope it helps


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

827 Views
ronaldpatton
Contributor I

Hello,

I am using code warrior 10.6 Special Edition.

I really need some help with the project I am working on.  I have followed the instructions and still can not find an acceptable solution.

I have created a new project that incorporated processor expert.

First when I select the processor type,  my specific chip is not included (MC9S08QGCPBE, which is the 16 pin version).  See screen shot.

Screenshot 2015-09-01 11.03.20_cr.jpg

Second, if I create a new project with out processor expert, the wizard allows me to select the proper chip.  Then I copy my source code into the project with the "add files" command.  This works.  However if I attempt to add any component via the Process Export menu,  the "add to project" is greyed out.  I can not add components to an existing project.

I would attach a zip file of the project if I knew how to attach files via this forum.

0 Kudos
Reply

827 Views
ronaldpatton
Contributor I

This is also very helpful, but how do I add this to an existing project (workspace)?

0 Kudos
Reply

827 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Ron,

I suggest you refer HCS08QRUG. this package includes nearly all HCS08 Peripheral Modules demo code. IIC on QG8 is also included as a demo.

http://cache.freescale.com/files/microcontrollers/doc/user_guide/HCS08QRUGSW.zip

http://cache.freescale.com/files/microcontrollers/doc/user_guide/HCS08QRUG.pdf

can this help you?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

827 Views
ronaldpatton
Contributor I

Hello,

Yes, these are very helpful.

Thanks,

Ron

0 Kudos
Reply