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.

i2c 24c256 - Cannot write more that 30bytes! can read 0 to 2000!

Status
Not open for further replies.

hitch

New Member
Hi
As always the oshonsoft Sim is working nicely - but the actual unit seems to only go from 0 to 30 of 40 bytes.
maybe i am missing something in code that the sim is ignoring?

Code:
eep2:
inp = 0  'used only to step thru the serdata array to reserve the value of bcnt
xbyte = xbyte + bcnt

	For eepstart = eepstart To xbyte
		I2CWrite sda, scl, 0xa0, eepstart, serdata(inp)
		WaitMs 7
		inp = inp + 1
	Next eepstart

this is the WHOLE PROBLEM !!!  after it runs through the loop the value is xbyte
then i erroneously add xbyte to it again, then pretty soon i am on the wrong address.
' eepstart = eepstart + xbyte

i changed bcnt to eepstart in the for loop. sometimes i wish i could kick my own butt

thank eric.

End
 
Last edited:
hi hitch,
Looked over your program, the way its written will cause problems in read/write to the EEPROM of the received/transmitted data.
If you explain what you want to happen within the program I would be pleased to help.
 
hi
basically when the user presses button 1 it will xmit all bytes from 0 until the ">" char.
button 2 = goto datareceive

Now i reuse the serdata array to store "a line of text" about 20 to 25 bytes
eepstart is just there to keep track of the start of the mem address and xbyte will be the end address.

So in a nutshell, I copy a text file to the pic - store it in 24c eep then just retrieve it via the rs232 xmit.

I was using the gosub / return , but i was trying to write "easy" code like you ;-) by just using the old qbasic type style.
I think the problem i am having is that i am messing up the addressing with eepstart / xbyte?

I wrote another eeptest program and i can write to 62, I was gonna try 2062 but i wanted to just take it slow and build morale again.
 
hi
basically when the user presses button 1 it will xmit all bytes from 0 until the ">" char.
button 2 = goto datareceive

Now i reuse the serdata array to store "a line of text" about 20 to 25 bytes
eepstart is just there to keep track of the start of the mem address and xbyte will be the end address.

So in a nutshell, I copy a text file to the pic - store it in 24c eep then just retrieve it via the rs232 xmit.

I was using the gosub / return , but i was trying to write "easy" code like you ;-) by just using the old qbasic type style.
I think the problem i am having is that i am messing up the addressing with eepstart / xbyte?

I wrote another eeptest program and i can write to 62, I was gonna try 2062 but i wanted to just take it slow and build morale again.

hi,
I have been looking at your program, using the 16F84, you are going to run out of PIC RAM space if the program grows much bigger.
Have you got the 16F628A PIC in the project.??
It would be possible to use the 628A UART and interrupt also more RAM space and the 4mHz internal clock.
 
hi
actually this would be the entire program. Are you saying that the serdata array is running out of ram ? i thought it would just keep accepting data as long as i restart the index thereby overwriting the previous content?
I can send a string like "hello world>" this would then write the string to eep and it would xmit 100%. if i do "string" + Cr [13] then
all ok for 1st string then when i send string 2, it does something wierd / or nothing.
it will accept the ">" char and exit the datareceive.
any other insight?

thanks for the reply - I am trying to get to the 628 but i still have to wait another week and a half. for the 17c44 to upgrade my picstart. I have tried making those jdm and rcs programmers but i can't get them to work.
 
problem solved !
and although it is raining cats and dogs here, i can feel the warm PIC sun!

until the next time.... maybe tomorrow !
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top