Hi, maybe a bit silly idea, but try to write PORTA.0 and PORTA.3 directly into the respective statements. The docs says (BTW which version u have?) a value or variable between 0 and 15 should be supplied. If the software takes the value of the variable instead of the symbol itself then it may be a problem... Regards, Imre +-----------------------------------------------------------------------+ | The information transmitted is intended only for the person or entity | | to which it is addressed and may contain confidential and/or | | privileged material. Any review, retransmission, dissemination or | | other use of, or taking of any action in reliance upon, this | | information by persons or entities other than the intended recipient | | is prohibited. If you received this in error, please contact the | | sender and delete the material from any computer. | +-----------------------------------------------------------------------+ On Mon, 14 Jun 2004 mantepsee2004@FREEMAIL.GR wrote: > Bruce i try your code but nothing! Here is my code in PicBasic Pro: > > > Include "modedefs.bas" ' Include serial modes > DEFINE OSC 4 > DEFINE I2C_SCLOUT ' make clock pin bipolar > DPIN var PORTA.3 ' I2C data pin > CPIN var PORTA.0 ' I2C clock pin > B0 var byte > B1 var byte > B2 var byte > > For B0 = 0 To 15 ' Loop 16 times > I2CWRITE DPIN,CPIN,%1010000,B0,[B0] ' Write each location's address to itself > Pause 10 ' Delay 10ms after each write > Next B0 > > loop: For B0 = 0 To 15 step 2 ' Loop 8 times > I2CREAD DPIN,CPIN,%1010000,$1,[B1,B2] ' Read 2 locations in a row > Serout PORTA.2,N9600,[#B1," ",#B2," "] ' Print 2 locations > Next B0 > > Serout PORTA.2,N9600,[10] ' Print linefeed > > Goto loop > > > I am using a 4MHZ crystal. The 24LC16B connections are: > Vdd to +5 > Vss to GND > A0-A2 to GND > WP to GND > SCL to a pull-up resistor 4.7K (it goes to VDD) and to PORTA.0 of pic > CDA to a pull-up resistor 4.7K (it goes to VDD) and to PORTA.3 of pic > > Please if anyone has an idea what is going wrong reply to this message! > > > > > > > > Thanks a lot!!! > > > > > > > Try this -- > > > > > > I2CWRITE PORTA.0,PORTA.,%1010000,$1,[B0] > > > > > > The 1st byte sent should be %1010 000 0 <-- read or write bit > > > control bits --^ ^----- 3-bit I2C device address > > > > > > Note: The 3-bit I2C device address 000 assumes you have the > > > 24LC16B address pins A0, A1 and A2 tied to ground. If you set > > > a different binary address, then change these 3-bits to that address. > > > Always leave the lsb (read or write bit) clear. PBP will automatically > > > toggle this bit for I2C read or write functions for you. > > > > > > The 2nd byte sent is the address in EEPROM you want to write data to. > > > Note that for PBP the hex value of 1 should be represented as $1, and > > > not 1$ as in your example. > > > > > > The 3rd byte will be the data you want to write to address $1, and should > > > be enclosed in [ ] braces. > > > > > > To write the value stored in variable B0 to EEPROM address location $1 > > > on the 24LC16B, the sample above will work. > > > > > > > > > > > > Regards, > > > > > > -Bruce > > > tech@rentron.com > > > http://www.rentron.com > > > > > > > > > > > > > > > > Problem with pic16f84a and 24lc16b > > > > I have a project that uses PIC16F84A and 24LC16B EEPROM. I writes my programs with > > > > PICBASIC PRO COMPILER. The point is that the EEPROM is not writting and i cant find > > > > what it is going wrong! > > > > In my schemmatic i have connect a resistor 4.7K to Data pin and VCC, WP to Vss, the Data pin > > > > to PORTA.0, Clock pin to PORTA.1 and of course Vss and Vcc to 5volt power supply. > > > > > > > > Next is the command from my program to write the pic to the 24lc16b the data from G0 to > > > > tha place B0 > > > > > > > > I2CWRITE PORTA.0,PORTA.1$,%1010000,B0,[G0] > > > > > > > > And it... nothing happens! What is going wrong? Please if anyone have an idea > > > > reply to me. > > > > > > > > Thanks, > > > > Taskins > > > > > > > > > > > > > > ____________________________________________________________________ > > > > > http://www.freemail.gr - dyqe\m upgqes_a gkejtqomijo} tawudqole_ou. > > > > > http://www.freemail.gr - free email service for the Greek-speaking. > > > > > > > > > > -- > > > > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > > > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > > > > > > > > > > > > > ____________________________________________________________________ > > > > http://www.freemail.gr - dyqe\m upgqes_a gkejtqomijo} tawudqole_ou. > > > > http://www.freemail.gr - free email service for the Greek-speaking. > > > > > > > > -- > > > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > > > > > > > > > > > -- > > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > > > > > ____________________________________________________________________ > > http://www.freemail.gr - dyqe\m upgqes_a gkejtqomijo} tawudqole_ou. > > http://www.freemail.gr - free email service for the Greek-speaking. > > > > -- > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > ____________________________________________________________________ > http://www.freemail.gr - dyqe\m upgqes_a gkejtqomijo} tawudqole_ou. > http://www.freemail.gr - free email service for the Greek-speaking. > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu