Hi all
I am using oshonsoft pic sim.
I need to save a "file" from pc to pic, comms are ok but i can only receive 1byte every 2sec.
this make transfers of 40bytes ! very slow.
any ideas on how to improve my code?
pic uses a 4mhz 3pin resonator and i have max232 on the comms. sending to the pc is no problem and receiving also works but sloowly.
code:
datareceive:
'serial input
memloc = 0
serb = 20
'while serb > 10
For i = 0 To 30
Serin PORTA.2, 2400, serinbyte
WaitMs 500 'tried different delays between rec.
serdata(i) = serinbyte
'looks for a % to signal end of trans.
If serinbyte = 37 Then i = 60
'Wend
Next i
'just a bit of comms from the pic to ack end
Serout PORTA.3, 2400, "end"
'made this a sep function coz i first thought that writing to eeprom would take longer than writing to the ram.
'write to onboard eeprom
For i = 0 To 30
Write i, serdata(i)
WaitMs 500
PORTB.2 = Not PORTB.2
Next i
Return
code end :
Any one with suggestions please. i have successfully (with gr8t help) added a 24lc256 into the mix, and i do not want to be writting 10Kb files at 1byte every 2sec.
I am using oshonsoft pic sim.
I need to save a "file" from pc to pic, comms are ok but i can only receive 1byte every 2sec.
this make transfers of 40bytes ! very slow.
any ideas on how to improve my code?
pic uses a 4mhz 3pin resonator and i have max232 on the comms. sending to the pc is no problem and receiving also works but sloowly.
code:
datareceive:
'serial input
memloc = 0
serb = 20
'while serb > 10
For i = 0 To 30
Serin PORTA.2, 2400, serinbyte
WaitMs 500 'tried different delays between rec.
serdata(i) = serinbyte
'looks for a % to signal end of trans.
If serinbyte = 37 Then i = 60
'Wend
Next i
'just a bit of comms from the pic to ack end
Serout PORTA.3, 2400, "end"
'made this a sep function coz i first thought that writing to eeprom would take longer than writing to the ram.
'write to onboard eeprom
For i = 0 To 30
Write i, serdata(i)
WaitMs 500
PORTB.2 = Not PORTB.2
Next i
Return
code end :
Any one with suggestions please. i have successfully (with gr8t help) added a 24lc256 into the mix, and i do not want to be writting 10Kb files at 1byte every 2sec.