Send binary file to pic over pc serial port
Hello,
Is there a simple way to send one file to a pic over a pc serial port?
Maybe using a Terminal?
I would like to store a binary file into a spi serial eeprom but i can't write a pc program to send the file. I don't need to re-invent the wheel. Such software brobably already exists.
No?
Thank you.
PC to PIC sending raw datafile to store to serial eeprom
You are great, thank you.
I have still a question. You are talking about flow control. When do I need it exactly?
Do I only need RX and GND? When interfacing PC and PIC using a max232, won't I need flow_CTS and DSR?
I've seen a code where the receive routine is something like:
FOR i = 1 to 15
HIGH pc_flow_cts
Hserin 1000,TIMEOUT_ROUTINE,[databyte_from_pc]
TIMEOUT_ROUTINE:
LOW pc_flow_cst
data_array[i] = databyte_from_pc
NEXT i
I beleive in the routine above, it request PC to send 8 bits, it stores it in the byte-sized databyte_from_pc variable, asks PC to pause transfer, stores the byte in the array then asks for the nex character and itt stops when 15 characters have been transfered, right?
In the Hyperterminal I'm ask what flow control to use:
Hardware, Xon/Xoff or none.
I beleive I will choose none in the case I'm not using the pc_flow_cts pin and choose 'hardware' if I'm using flow control pin...?
What is the advantage of not using flow control?
I might be using only RX and GND pins and add a pause after each byte so I won't need to use MAX232 chip and I don't need flow control, is this right?
(I think I've seen a schematic in the PBP manual (about SERIN) where only an inline 22K resistor is used on RX pin, so only 2 pins are used, I guess it also can be used with HSERIN...?).
You write:
"In the [File | Properties | Settings Tab | ASCII Setup Button] you can add the delays required to give the PIC time to write to the EEPROM, 10ms or more "Character Delay" depending on your EEPROM. Then you don't need any complex buffers or flow control."
-> I will have to send about 88KBytes of data into the serial EEPROM, if I add a 10ms after each byte, it will take years to tranfer all the file, no?
You also write:
"From the [Transfer | Send Text File] command, it actually sends a binary file. It just uses the default .TXT extension. But you can pick any file."
-> I'm asked for the protocol to use (1K xmodem, kermit, xmodem,ymodem,y modemg, zmodem, zmodem with crash recovery... Which one should I choose???
How does the PIC know that data is arriving on the RX pin if no interrupt is used?
I have to write a routine with a loop in which the user will be requested to send the file from PC to pic, right?
HSERIN only gets one byte? So I have to write a loop that will record all the bytes?
Sorry if I ask silly questions. I'm reading info about HSERIN and pic hardware serial port right now so I might find answers soon I guess.
Re: Send binary file to pic over pc serial port
Darrel,
I found this suggestion of yours on a web search, and it seems to fit a requirement we have, though not involving a PIC. It almost works, but it looks like every other byte has its MSB inverted when the data is sent out of the COM port. Do you have any idea why? Is there some HyperTerminal setting we are missing?
Thanks,
Eliot Mayer
Analogic Corporation
Peabody, MA, USA
Quote:
Originally Posted by
Darrel Taylor
Hyperterminal is all you need.
From the [Transfer | Send Text File] command, it actually sends a binary file. It just uses the default .TXT extension. But you can pick any file.
In the [File | Properties | Settings Tab | ASCII Setup Button] you can add the delays required to give the PIC time to write to the EEPROM, 10ms or more "Character Delay" depending on your EEPROM. Then you don't need any complex buffers or flow control.
It can be received on the PIC end with SERIN(2) or HSERIN, and stored to the EEPROM byte by byte.
hth,
Re: Send binary file to pic over pc serial port
It's hard to say, but it sounds like parity is enabled in hyperterminal.
Re: Send binary file to pic over pc serial port (HyperTerminal, Tera Term)
Thanks, we thought that parity was disabled, but we'll double check that. Meanwhile, my colleague found a program that did the job of sending a binary file out the COM port with no problems. It's called Tera Term. I'm not sure, because he got it from another colleague, but it may be the free program posted at http://www.ayera.com/teraterm/.
Quote:
Originally Posted by
Darrel Taylor
It's hard to say, but it sounds like parity is enabled in hyperterminal.