how can i store data greater than 128 bytes in buffer?
Just make the buffer larger than 128 bytes, where is your problem with that?
i have attached the code. tx buffer is working fine til 128 size but 256 is not working
In line 312 you get a warning which is indeed an error! A uint8 is always smaller than 256, so it is an endless loop.
NEVER declare a loop variable (i) as global when not in absolute need. When you do not want that the var allocatesd automatically (which is the default), declare it as "static".
thanks a lot Bob. I changed the i declaration to uint16 i. the program is working fine for 256 bytes. when i did for 512 bytes - the data on hyperterminal comes overlapping in peices.
i have to transfer total 239535 bytes? what should be the approach?
Transfering your bytes is not all you have to do, you have to process your data which means that you have to transmit them after receiving. You can do that by processing the data in small chunks in a loop. A more advanced (and more difficult to program) is the method which is using two buffers, one to store the data in and one you transfer data from. This only makes sense when interrupt driven.
As Bob states, you need to process the data from the UART
remember that the write cycle time of a EEPOM is in the range of 2-5ms. Take 5ms for now.
writing 256 byte means 1.3 second. just for the writing to the EEPROM. ( yes the SPI interface is much faster, but you still need to wait for the chip to finish writing the data).
If your program is to recive 256 byte from UART than write 256 byte to EEPROM, then you have to send 256 byte and wait 1.3 second before sending the other 256 bytes.
If you use two recive buffer, you can use 2nd buffer while writing using the 1st buffer but you still limited by the speed of the EEPROM.
BTW can you tell us what chips you use, so we can see what timing it needs to be.
Also if you can use SPI flash and it should be faster with page write/program mode.
There seems to have issues with the way you wirte to the EEPROM as well, but lets fix the the timing issue first.
thanks all for inputs. i am now using two buffers one for filling data from uart and one to write data on eeprom. now some data is getting missed in between for 2048 bytes program .
1. do i need to introduce delay.
2. even if i set 2400 bps on uart at psoc creator and hyperterminal some bytes getting missed.
If your buffer is 128 bytes, worst case EEPROM erase/write cycle is 20 ms per
row, row size is 16 bytes, so thats 20 mS X (128 / 16 ) = 160 mS to dump the whole
Of course you have to factor in the clock tolerance as that effects the actual time
you will erase/write. If IMO at 48 Mhz thats 10% of variation.