Search found 539 matches

by bpislife
11 Mar 2016 03:10
Forum: mikroC PRO for ARM General
Topic: I/O expander for I2C-bus + STM32 mikromedia
Replies: 6
Views: 5012

Re: I/O expander for I2C-bus + STM32 mikromedia

That appears to be correct since it appears you don't have to identify a register you want to write to. I would double check your hardware setup to make sure you address is correct. Do you have a logic analyzer (even a cheap usb one would be fine). The idea would be to see if you are transmitting da...
by bpislife
01 Mar 2016 02:59
Forum: mikroC PRO for ARM General
Topic: I/O expander for I2C-bus + STM32 mikromedia
Replies: 6
Views: 5012

Re: I/O expander for I2C-bus + STM32 mikromedia

So I get that you are new, but you need to read the datasheet. To write, the master (microcontroller) first addresses the slave device. By setting the last bit of the byte containing the slave address to logic 0 the write mode is entered. The PCA9670 acknowledges and the master sends the data byte f...
by bpislife
25 Feb 2016 19:44
Forum: mikroC PRO for ARM General
Topic: I/O expander for I2C-bus + STM32 mikromedia
Replies: 6
Views: 5012

Re: I/O expander for I2C-bus + STM32 mikromedia

Take a look at the datasheet for the part. Specifically section 8.2 page 12.

http://www.nxp.com/documents/data_sheet/PCA9670.pdf
by bpislife
01 Feb 2016 21:19
Forum: mikroC PRO for PIC32 General
Topic: L3GD20 sensor using I2C interface and PIC32MX795F512L
Replies: 1
Views: 2306

Re: L3GD20 sensor using I2C interface and PIC32MX795F512L

Make sure you have pull resistors enabled for SCL and SDA. Without digging too deep, I also don't know the PIC32 all that well, is there a restart or not. If there isn't then it looks good otherwise the second start should be a restart. unsigned short L3GD20_ReadReg(unsigned short address, unsigned ...
by bpislife
01 Feb 2016 20:51
Forum: mikroC PRO for PIC General
Topic: Help coming from XC8 compiler to MicroC Pro for PIC
Replies: 1
Views: 1120

Re: Help coming from XC8 compiler to MicroC Pro for PIC

How do you set the Config Bits? Through Project Settings Is there a way to view/edit the startup code the is obviously being done by MicroC? Not sure... I often like to view the source code of the library functions, and modify them to fit my application. Is the source code of library functions visi...
by bpislife
01 Feb 2016 20:48
Forum: mikroC PRO for ARM General
Topic: I2C PROBLEM
Replies: 6
Views: 6334

Re: I2C PROBLEM

Rather than having me explain every nuance, here is a nice online tutorial that explains the basic functionality of I2C. Device addresses are 7-bit and the 8-bit is the Read/Write bit (0 right, 1 read).

http://embedded-lab.com/blog/lab-14-int ... unication/
by bpislife
24 Jan 2016 04:45
Forum: mikroC PRO for ARM General
Topic: I2C PROBLEM
Replies: 6
Views: 6334

Re: I2C PROBLEM

The example code shows how to manage the I2C peripheral. You will need to update the device address, ack/nack sequence and register addresses based on how you are controlling the device. Don't forget you will need pull up resistors on these lines.
by bpislife
11 Jan 2016 02:55
Forum: mikroC PRO for PIC General
Topic: Converting Arduino Code?
Replies: 1
Views: 2230

Re: Converting Arduino Code?

I have helped others with this in the past. If you have access to the source code, it should be straight forward to figure out what the arduino code is trying to do. Often you have to rewrite it since Arduino SPI libraries (along with everything else) are different, but with Mikroe's libraries it sh...
by bpislife
11 Jan 2016 02:48
Forum: mikroC PRO for ARM General
Topic: I2C PROBLEM
Replies: 6
Views: 6334

Re: I2C PROBLEM

First I think you should give it a proper try by referencing the help file and using the examples. You only need to initialize once so why are you putting that in the loop? Also, the init needs a speed. Like I said, start with the help file.
by bpislife
11 Jan 2016 02:43
Forum: mikroC PRO for PIC General
Topic: atoi issues
Replies: 2
Views: 1486

Re: atoi issues

Not sure I am going to help much, but have you tried to see what you get from the debugger on the buffer? Could it be that you don't have all numerics in the field and that it is seeing a LF and CR in the variable?
by bpislife
16 Dec 2015 03:45
Forum: User Projects
Topic: ADC I2C Communication Issue
Replies: 3
Views: 4620

Re: ADC I2C Communication Issue

Can you share your schematic? I would make sure you have a pull up resistor (~4.7k) on the SDA and SCL line. Additionally if you have access to an o-scope can you see a pulse when you write? The MCU will freeze if it doesn't see an ACK from the ADC and wait for ever until it sees it. You can built a...
by bpislife
02 Dec 2015 03:31
Forum: mikroC PRO for PIC General
Topic: Mikroc coding help
Replies: 1
Views: 1009

Re: Mikroc coding help

Can you send the proteus file? I would like to try a few things before I can recommend the definitive fix. You may need to consider pull down resistors on the M1 and M2 line. Also, make sure your Port E is configured right in the compiler's project setting.
by bpislife
02 Dec 2015 03:21
Forum: User Projects
Topic: ADC I2C Communication Issue
Replies: 3
Views: 4620

Re: ADC I2C Communication Issue

Let me take a crack at this. First you are initializing I2C to run at 100Hz, which is a bit on the slow end. If you want 100KHz, you need to make this I2C1_Init(100000) To Write Data to I2C those sequence below is correct. I2C1_Start() I2C1_Write(WriteADCAdd) ' Send 7-bit address and 1-bit Write com...
by bpislife
25 Nov 2015 03:44
Forum: mikroPascal PRO for AVR General
Topic: i2c displayadaptor sample code somewhere
Replies: 4
Views: 3195

Re: i2c displayadaptor sample code somewhere

The soft I2C library is built into the Mikroe Editor.

Go to advanced search