Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 1:a841df4b2546
- Parent:
- 0:5c2f03380e80
- Child:
- 2:9f3ea84403ca
--- a/main.cpp Mon Jun 16 15:36:48 2014 +0000
+++ b/main.cpp Mon Jun 16 16:59:31 2014 +0000
@@ -1305,13 +1305,11 @@
//LPC_I2C1->I2CONCLR = 0x08;
- I2C_SetClock (LPC_I2C1, 100000); // * @brief Setup clock rate for I2C peripheral
+ //I2C_SetClock (LPC_I2C1, 100000); // * @brief Setup clock rate for I2C peripheral
LPC_I2C1->MMCTRL |= I2C_I2MMCTRL_MM_ENA; // enable monitor mode
LPC_I2C1->MMCTRL |= I2C_MONITOR_CFG_MATCHALL; // I2C_MONITOR_CFG_MATCHALL
LPC_I2C1->I2CONSET |= I2C_I2CONSET_I2EN; // enable the i2c interface
- // Write 0x44 to I2CONSET to set the I2EN and AA bits, enabling Slave functions.
- //LPC_I2C1->I2CONSET = 0x44;
/* interrupt handler */
NVIC_EnableIRQ(I2C1_IRQn);
@@ -1322,21 +1320,25 @@
while (1) {
pc.printf(" **************** \n\r");
wait(0.3);
+ LPC_I2C1->I2CONCLR = 0x08; // Clear the interrupt flag
+ pc.printf("dataBuff has %x in it , and the count is %x \n\r",myByte, count++);
- uint8_t retdat;
- pc.printf("Waiting for a Byte to come in\r\n");
- uint32_t aWord = I2C_GetByte (LPC_I2C1, &retdat, FALSE);
- pc.printf(" retDat = %x, stat = %x \n\r",retdat,aWord);
+ // uint8_t retdat;
+ // pc.printf("Waiting for a Byte to come in\r\n");
+ // uint32_t aWord = I2C_GetByte (LPC_I2C1, &retdat, FALSE);
+ // pc.printf(" retDat = %x, stat = %x \n\r",retdat,aWord);
pc.printf("Data Buffer *********** = %x !\n\r",LPC_I2C1->I2DATA_BUFFER);
pc.printf("Status = %x\n\r",LPC_I2C1->I2STAT);
pc.printf("I2CONSET = %x\n\r",LPC_I2C1->I2CONSET);
pc.printf("Interrupt = %x\n\r",I2C_I2CONSET_SI); // what is the value of the interupt
+
+
/* Check SI flag ready */
//if ((LPC_I2C1->I2CONSET & I2C_I2CONSET_SI) ){
if(1) {
- pc.printf("LPC_I2C1->I2CONSET & I2C_I2CONSET_SI is true \r\n");
+ //pc.printf("LPC_I2C1->I2CONSET & I2C_I2CONSET_SI is true \r\n");
myByte = I2C_MonitorGetDatabuffer(LPC_I2C1);
LPC_I2C1->I2CONCLR = 0x08; // Clear the interrupt flag
pc.printf("dataBuff has %x in it , and the count is %x \n\r",myByte, count++);