get average voltage

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
Puddy32
Posts: 7
Joined: Sat Mar 24, 2012 12:49 am
Has thanked: 1 time
Contact:

get average voltage

Post by Puddy32 »

Hi
I have to get the average value of 4 inputs to a philips pcf8591 using I2C and a 16F88. However I have read that the pic cant handle I2C that well and I will have ' bit bang' the data. I dont really know what this means.If anyone could give me some idea of the c code I would be very grateful.
the pcf is a a/d d/a converter.I have to take four inputs, read the digital data into the pic, get the average and send it back to the pcf that sends out the average analog output.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: get average voltage

Post by Enamul »

However I have read that the pic cant handle I2C that well and I will have ' bit bang' the data. I dont really know what this means.
Where you read that? PIC can handle I2C excellent and the PIC you have selected don't have hardware I2C. But you can always use software I2C which is implemented in Flowcode and can be used very easily. Do you have Flowcode or you want to do that in C as you don't have Flowcode?
Enamul
University of Nottingham
enamul4mm@gmail.com

Puddy32
Posts: 7
Joined: Sat Mar 24, 2012 12:49 am
Has thanked: 1 time
Contact:

Re: get average voltage

Post by Puddy32 »

I have to do it in c.
So if the pic doesnt have hardware I2C how do you use it.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: get average voltage

Post by Enamul »

Hi,
you can have a look following link..
http://www.keil.com/i2c/examples.asp
Enamul
University of Nottingham
enamul4mm@gmail.com

Post Reply