can some one help, i would like to send data from the terminal tool to the pic16f877a, when the pic receives the data
one byte at a time i need to write it to the eeprom similar to this
for x := 1 to 20
begin
Eeprom_write(x,Usart_read);
end;
all i am getting is one byte written to all addresses how do get "hello world"
split over the eeprom addresses
ie
address 1 = h
address 2 = e
address 3 = l
etc etc..
thanks in advance
usart rs232
Re: usart rs232
No wonder, your code does exactly this. What is Usart_read? A char, a string?trigstig wrote:all i am getting is one byte written to all addresses
Re: usart rs232
usart_read is taken from the example given it started of recieved_byte := usart_read after data ready test
Re: usart rs232
Then it's of byte type and your code writes the same byte to all EEPROM cells.trigstig wrote:usart_read is taken from the example given it started of recieved_byte := usart_read after data ready test
Unless you send single chars only, that's not possible as writing byte to EEPROM takes more time than receiving a byte (at least for reasonable serial communication speed).when the pic receives the data one byte at a time i need to write it to the eeprom
You'd have to receive whole message first and collect it in a string or array of chars and only then store it in EEPROM.
You could try to use UARTx_Read_Text procedure which will wait for whole message.
Re: usart rs232
thats ok but the method you describe "UARTx_Read_Text" only allows 20 char i need to split 120 bytes
unless theres a way of increasing the size.
unless theres a way of increasing the size.
Re: usart rs232
You should check first (with e.g. function UARTx_Data_Ready) if a byte did come in via uart before writing it to eeprom.trigstig wrote:can some one help, i would like to send data from the terminal tool to the pic16f877a, when the pic receives the data
one byte at a time i need to write it to the eeprom similar to this
for x := 1 to 20
begin
Eeprom_write(x,Usart_read);
end;
all i am getting is one byte written to all addresses how do get "hello world"
split over the eeprom addresses
ie
address 1 = h
address 2 = e
address 3 = l
etc etc..
thanks in advance
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Re: usart rs232
Then you'll have to do it yourself, receiving and storing the message in a string or array of chars byte-by-byte. Only then you may store it in EEPROM.trigstig wrote:thats ok but the method you describe "UARTx_Read_Text" only allows 20 char i need to split 120 bytes unless theres a way of increasing the size.
And take into account that storing 120 bytes may take as long as one second
Re: usart rs232
i will try a few things let you know if i am succesfull. thanks for input.
Re: usart rs232
You could switch to the PRO version of mP. UARTx_Read_Text allows there for longer strings.