Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC16F628 and 24LC512

Status
Not open for further replies.

seba0902

New Member
Hi guys,I have a problem,Im using 16f628 to read temperature from a sensor and stamp it out via rs232.Now what I want to do is to store the data in a exernal eeprom like 24lc512 and after download it via RS232.I havent worked with external eeproms and I dont know where to implement the code for writing data to external eeprom.Any help would be apreciate.Thanks
 
In what language ASM C Basic if you want to use ASM Nigel has some good code
here
 
Yes,and I dont know from where to start from,where to implement the I2C code,in witch part of code
 
Last edited:
it shows you how to set it up here with out any code it would be hard to help you add it in.
Read about I2Cread and I2Cwrite you can find it here PicBasic Pro Compiler Manual
Here a picture showing how to hook it up it shows a 16f84 don't mined that you can use any chip **broken link removed**
 
Last edited:
I said I doesn't matter what chip you use
The circuit is for a 16f84 But it hooks up the same on a 16f628a just no xtal
The circuit is from PicBasic manual which is what you said you where using.

The main thing is you use ra0 and ra1 that's the default setting for picbasic

I said don't mined the chip you can use any
 
Last edited:
Thank you,I'll do that,can I use that code from the book?If yes where do I have to write it,in witch part of the code?
 
The I2Cread is not that hard same for I2Cwrite. Now I don't no where you would use it because you have not posted any code

Here a sample from picbasic pro
Code:
       Include "modedefs.bas"          ' Include serial modes

SO      con     0                       ' Define serial output pin
DPIN    var     PORTA.0                 ' I2C data pin
CPIN    var     PORTA.1                 ' I2C clock pin
B0      var     byte
B1      var     byte
B2      var     byte

        For B0 = 0 To 15                ' Loop 16 times
                I2CWRITE DPIN,CPIN,$A0,B0,[B0]  ' Write each location's address to itself
                Pause 10                ' Delay 10ms after each write
        Next B0

mainloop: For B0 = 0 To 15 step 2         ' Loop 8 times
                I2CREAD DPIN,CPIN,$A0,B0,[B1,B2]        ' Read 2 locations in a row
                Serout SO,N2400,[#B1," ",#B2," "]       ' Print 2 locations
        Next B0

        Serout SO,N2400,[10]            ' Print linefeed

        Goto mainloop
 
Last edited:
Im not at the computer where I have the code,Im away now,so I cant post tha code,sorry.Is this same code witch I can use in my program code?Does this write data to eeprom and after how I read it from RS232?Do I need to build a program for reading the data out?The program witch I have just prints the data out on a terminal,without any buttons,so I dont know if will work.
 
Last edited:
I would try it first learn how it works and then you'll Know how to added it in your program.
 
Ok,thank you,do I also need something else to know?After learning this I need to program the eeprom too?Thank you
 
Last edited:
Thank you.So just need to implement the I2C code in PIC,right?Can you recomend me any menu builder software?
 
Last edited:
seba0902 . . . . . I think you are way out of your depth.
Do some PIC programming before you start to work on a complex project.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top