M
M
Michael2016-05-27 20:27:24
Do it yourself
Michael, 2016-05-27 20:27:24

Where can I find i2c slave and master libraries for atmega328p?

In general, the question is in the title, but there are a couple of nuances.
Google immediately shows the github and it would seem - ready:
https://github.com/g4lvanix/I2C-slave-lib
https://github.com/g4lvanix/I2C-master-lib
But I still could not pick them up in the CodeVisionAvr environment , the compiler swears.
And I really didn’t find anything else (I don’t exclude that I was looking badly).
I found several manuals on how to raise everything without libraries, but it is too tricky and was written in 2009-2012, and it’s somehow wrong to necropost.
Briefly about the project:
2 atmega328 master and slave, respectively, the slave has only 2 pins free, moreover, any (that is, either uart or i2c) master must send him 2 bytes of information - 2 numbers: the cell number and the value that needs to be put there.
The master must keep in touch via uart (to receive commands from above) and sometimes send these 2 numbers to the slave.
And optionally, 3 ADC modules may appear (or special microcircuits, or attiny44 (or something similar)) from them the master must receive values ​​on request.
Actually, that's why I want i2c, so that everyone hangs on the same bus.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
A, 2016-06-09
@AndrBell

those. the problem sounds like this: "But I could not pick them up in the CodeVisionAvr environment, the compiler swears."
then start connecting step by step, start with H files.
for example include i2c_master.h in your program.
Fix the generated errors.
for example, maybe. swears at uint8_t . define it yourself as unsigned char (or more correctly as an unsigned int of 8 bits, for example u8, I don’t know what types are defined in CodeVisionAvr).
Let's start from the idea that char in C is usually 8 bits.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question