Chameleon-PIC Nurve Networks, Chameleon-PIC Datasheet - Page 165

MCU, MPU & DSP Development Tools PIC24 & PROPELLER DEV SYSTEM (SBC)

Chameleon-PIC

Manufacturer Part Number
Chameleon-PIC
Description
MCU, MPU & DSP Development Tools PIC24 & PROPELLER DEV SYSTEM (SBC)
Manufacturer
Nurve Networks
Datasheet

Specifications of Chameleon-PIC

Processor To Be Evaluated
PIC24
Data Bus Width
16 bit
Interface Type
USB, VGA, PS/2, I2C, ISP, SPI
Operating Supply Voltage
3.3 V, 5 V
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Description:
Example(s):
//////////////////////// WRITE //////////////////////////////////
// First enable a start operation
I2C1CONbits.SEN = 1;
// Wait until the Start sequence has finished
I2C_WaitTillIdle();
// Write operation
unsigned char Addr = (0x4F << 1) | 0x00;
I2C1TRN = Addr;
// Wait till data is transmitted.
while(I2C1STATbits.TBF);
I2C_WaitTillIdle();
//////////////////////// READ //////////////////////////////////
// Read operation
unsigned char Addr |= 0x01;
I2C1TRN = Addr;
while(I2C1STATbits.TBF);
I2C_WaitTillIdle();
// Enable receive
I2C1CONbits.RCEN = 1;
while(!I2C1STATbits.RBF);
TempMSB = I2C1RCV;
// Now send ack
I2C1CONbits.ACKDT = 0;
I2C1CONbits.ACKEN = 1;
while(I2C1CONbits.ACKEN == 1);
_______________________________________________________________________________________________
Function Prototype:
Parameters:
Return:
Description:
Example(s):
// Include main system header
#include "CHAM_PIC_SYSTEM_V010.h"
// Include CHAM I2C/SPI driver
#include "CHAM_PIC_I2C_SPI_DRV_V010.h"
int main (void)
{
// Always call SYS_ConfigureClock first after main() begins
SYS_ConfigureClock(MAX_FCY_RATE);
void SPI_Init(void);
SPI Polarity 0
SPI Phase 0
Master Enabled
Prescalar = FCY/16 = ~2.75 Mbps
I2C_WaitTillIdle(…) stalls the PIC24’s execution until the I2C has finished all outgoing operations. This
could include operations such as acknowledging, starting a send, initiating a receive sequence, resetting,
etc.
The following example shows how to send and receive a byte of data. Remember that the
communications protocol is going to be different depending on what device you are working with.
None.
SPI_Init(…) initializes the SPI peripheral hardware on the PIC24 with the following parameters:
This example shows a simple usage scenario.
None.
// Wait till data is transmitted.
// Wait until we have data
// save byte received
// Wait till ACK/NACK sequence is over
// initiate Start on SDA and SCL pins
// Send the data out
// Configure clock
© 2009 NURVE NETWORKS LLC “Exploring the Chameleon PIC 16-Bit”
165

Related parts for Chameleon-PIC