PIC32 help

Thread Starter

RoboticFan87

Joined Sep 12, 2009
38
Hey guys,
I have PIC32 on a UBW32 development board which is an amazing board so simple and easy to learn.
Im a newbie when it comes to programming PICS using C language so please be patient with me.
I need to program the microcontroller to interface with a control chip (DS2482S-800). I dont need LEDs or LCDs or anything just simple I/O interface to send requests to the chip from PC and to receive replys from the chip to the PC. Any ideas how to start?
Is there any sample code i can use as my guide?
Thank you in advance!
 

BMorse

Joined Sep 26, 2009
2,675
The I2C module provides complete hardware support for both Slave and Multi-Master modes of the I2C serial communication standard. The PIC32MX3XX/4XX devices have up to two I2C interface modules, denoted as I2C1 and I2C2. Each I2C module has a 2-pin interface: the SCLx pin is clock and the SDAx pin is data.
Each I2C module ‘I2Cx’ (x = 1 or 2) offers the following key features:
• I2C Interface Supporting both Master and Slave Operation.
• I2C Slave Mode Supports 7 and 10-bit Address.
• I2C Master Mode Supports 7 and 10-bit Address.
• I2C Port allows Bidirectional Transfers between Master and Slaves.
• Serial Clock Synchronization for I2C Port can be used as a Handshake Mechanism to Suspend and Resume Serial transfer (SCLREL control).
• I2C Supports Multi-master Operation; Detects Bus Collision and Arbitrates Accordingly.
• Provides Support for Address Bit Masking.
//-----------------------------------------------------------------------------
I2C1 uses pin #67 for SDA (A15 on UBW32), and pin #66 for SCL (A14 on UBW32) --
//-----------------------------------------------------------------------------
I2C2 uses pin #59 for SDA (A3 on UBW32), and pin #58 for SCL (A2 on UBW32).
//-----------------------------------------------------------------------------
use a 4.7k pullup resistor on SDA when you connect it.
//-----------------------------------------------------------------------------
go here >> http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2609 for sample code, first example on top for I2C slave is what you can use as a code template.

//-----------------------------------------------------------------------------
You could use the UBW32 itself to connect to PC and receive data, if you are familiar with programming languages for PC such as VB, C or something similar, you can access the UBW32 via a comm port (it shows up as comm6 on my pc). In VB you can communicate with the UBW32 via the MSComm Control.
 
Last edited:
Top