Dúvida EEPROM , será que alguém me responde , dessa vez ?, rsrs - Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)2024-03-28T21:16:58Zhttps://labdegaragem.com/forum/topics/d-vida-eeprom-ser-que-algu-m-me-responde-dessa-vez-rsrs?feed=yes&xn_auth=noSe voce usar uma EEPROM i2c c…tag:labdegaragem.com,2013-01-04:6223006:Comment:1975732013-01-04T00:32:22.405ZRodrigo Danielhttps://labdegaragem.com/profile/RodrigoDaniel
<p>Se voce usar uma EEPROM i2c como uma 24LCxx, voce pode usar as seguintes classes para escrever por byte, inteiro, longo, ou alpha:</p>
<p></p>
<p>// ******************* READ BYTE EEPROM ********************** //<br></br>byte WireEepromReadByte(int theDeviceAddress, unsigned int theMemoryAddress) {<br></br> byte theByteArray[sizeof(byte)];<br></br> WireEepromRead(theDeviceAddress, theMemoryAddress, sizeof(byte), theByteArray);<br></br> return (byte)(((theByteArray[0] << 0)));<br></br>}<br></br>//…</p>
<p>Se voce usar uma EEPROM i2c como uma 24LCxx, voce pode usar as seguintes classes para escrever por byte, inteiro, longo, ou alpha:</p>
<p></p>
<p>// ******************* READ BYTE EEPROM ********************** //<br/>byte WireEepromReadByte(int theDeviceAddress, unsigned int theMemoryAddress) {<br/> byte theByteArray[sizeof(byte)];<br/> WireEepromRead(theDeviceAddress, theMemoryAddress, sizeof(byte), theByteArray);<br/> return (byte)(((theByteArray[0] << 0)));<br/>}<br/>// ******************* WRITE BYTE EEPROM ********************** //<br/>void WireEepromWriteByte(int theDeviceAddress, unsigned int theMemoryAddress, byte theByte) {<br/> byte theByteArray[sizeof(byte)] = {<br/> (byte)(theByte >> 0) };<br/> WireEepromWrite(theDeviceAddress, theMemoryAddress, sizeof(byte), theByteArray);<br/>}<br/>// ******************* WRITE INT EEPROM ********************** //<br/>void WireEepromWriteInt(int theDeviceAddress, unsigned int theMemoryAddress, int theInt) {<br/> byte theByteArray[sizeof(int)] = {<br/> (byte)(theInt >> 8), (byte)(theInt >> 0) };<br/> WireEepromWrite(theDeviceAddress, theMemoryAddress, sizeof(int), theByteArray);<br/>}<br/>// ******************* READ INT EEPROM ********************** //<br/>int WireEepromReadInt(int theDeviceAddress, unsigned int theMemoryAddress) {<br/> byte theByteArray[sizeof(int)];<br/> WireEepromRead(theDeviceAddress, theMemoryAddress, sizeof(int), theByteArray);<br/> return (int)(((theByteArray[0] << 8)) | (int)((theByteArray[1] << 0)));<br/>}<br/>// ******************* READ EEPROM ********************** //<br/>void WireEepromRead(int theDeviceAddress, unsigned int theMemoryAddress, int theByteCount, byte* theByteArray) {<br/> for (int theByteIndex = 0; theByteIndex < theByteCount; theByteIndex++) {<br/> Wire.beginTransmission(theDeviceAddress);<br/> Wire.write((byte)((theMemoryAddress + theByteIndex) >> 8));<br/> Wire.write((byte)((theMemoryAddress + theByteIndex) >> 0));<br/> Wire.endTransmission();<br/> delay(5);<br/> Wire.requestFrom(theDeviceAddress, sizeof(byte));<br/> theByteArray[theByteIndex] = Wire.read();<br/> }<br/>}<br/>// ******************* WRITE EEPROM ********************** //<br/>void WireEepromWrite(int theDeviceAddress, unsigned int theMemoryAddress, int theByteCount, byte* theByteArray) {<br/> for (int theByteIndex = 0; theByteIndex < theByteCount; theByteIndex++) {<br/> Wire.beginTransmission(theDeviceAddress);<br/> Wire.write((byte)((theMemoryAddress + theByteIndex) >> 8));<br/> Wire.write((byte)((theMemoryAddress + theByteIndex) >> 0));<br/> Wire.write(theByteArray[theByteIndex]);<br/> Wire.endTransmission();<br/> delay(5);<br/> }<br/>}</p> Beleza, qualquer dúvida, perg…tag:labdegaragem.com,2013-01-03:6223006:Comment:1973812013-01-03T17:17:15.947ZWiecherthttps://labdegaragem.com/profile/MarcosDanielWiechert
<p>Beleza, qualquer dúvida, pergunte mesmo. :)</p>
<p>Beleza, qualquer dúvida, pergunte mesmo. :)</p> Bacana amigo , como sou no…tag:labdegaragem.com,2013-01-03:6223006:Comment:1975462013-01-03T17:07:54.671ZVinícius de Matoshttps://labdegaragem.com/profile/ViniciusdeMatos
<p> Bacana amigo , como sou novato ainda estou meio perdido , me adaptando ainda , mas sem grandes dificuldades ainda, valeu pela resposta , já sei onde procurar agora rs antes de posta algo , mais se você não me desse essa simples dica talvez demoraria um pouco mais pra descobrir , obg , valeu.</p>
<p> Bacana amigo , como sou novato ainda estou meio perdido , me adaptando ainda , mas sem grandes dificuldades ainda, valeu pela resposta , já sei onde procurar agora rs antes de posta algo , mais se você não me desse essa simples dica talvez demoraria um pouco mais pra descobrir , obg , valeu.</p> Olá,
Veja este tutorial: http…tag:labdegaragem.com,2013-01-03:6223006:Comment:1975412013-01-03T16:26:01.893ZWiecherthttps://labdegaragem.com/profile/MarcosDanielWiechert
<p>Olá,</p>
<p>Veja este tutorial: <a href="http://labdegaragem.com/profiles/blogs/tutorial-usando-a-eeprom-do-arduino-para-armazenar-dados-de-forma">http://labdegaragem.com/profiles/blogs/tutorial-usando-a-eeprom-do-arduino-para-armazenar-dados-de-forma</a></p>
<p>É sempre bom tentar ver os tutoriais aqui do site antes de abrir uma nova discussão, normalmente as dúvidas mais comuns podem ser sanadas com o material postado lá, talvez esta sejuma das razões para a falta de respostas aos outros…</p>
<p>Olá,</p>
<p>Veja este tutorial: <a href="http://labdegaragem.com/profiles/blogs/tutorial-usando-a-eeprom-do-arduino-para-armazenar-dados-de-forma">http://labdegaragem.com/profiles/blogs/tutorial-usando-a-eeprom-do-arduino-para-armazenar-dados-de-forma</a></p>
<p>É sempre bom tentar ver os tutoriais aqui do site antes de abrir uma nova discussão, normalmente as dúvidas mais comuns podem ser sanadas com o material postado lá, talvez esta sejuma das razões para a falta de respostas aos outros tópicos. :)</p>
<p>Abraço.</p>