View previous topic :: View next topic |
Author |
Message |
Spiffy
Joined: 21 Jan 2004 Posts: 12
|
Sending data From hyperterminal to my PIC through Rs232 |
Posted: Fri Feb 20, 2004 8:55 am |
|
|
Hey! Good morning, afternoon and night...
My goal is to send over a text file to my PIC and take the ASCII message for example "HEllo" and store it in my EEPROM memory. But I don`t know how to setup for my PIC to read the info hyperterminal is sending.
So basicly Im askoing FOR HELP!
Please
This is for my school project I`m making an electronic drum eventually I will use this knowledge to store data from a WAV file. I will extract the hex code from the WAV file and send it to my memory with my PIC then convert the numeric data to analogue at the rihgt frequency and play it in an amp circuit. Anyways Im a long way from there so I need to start with this |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Fri Feb 20, 2004 9:18 am |
|
|
There are some bootloaders that move large files from the PC. Maybe you coule study one of those programs and learn from it. |
|
|
Spiffy
Joined: 21 Jan 2004 Posts: 12
|
|
Posted: Fri Feb 20, 2004 9:21 am |
|
|
Neutone Hmmmmmm.... sounds interesting whats a bootloader and where could I find this?? |
|
|
jds-pic2 Guest
|
|
Posted: Fri Feb 20, 2004 1:25 pm |
|
|
Spiffy wrote: | Neutone Hmmmmmm.... sounds interesting whats a bootloader and where could I find this?? |
spiffy,
don't bother with the bootloader. neutone was simply being polite and that was his way of saying that you need to learn it for yourself. however, studying the bootloader at this stage will simply frustrate you as the code will be very terse, since bootloaders are inherently designed to fit in small spaces.
my US$0.02 ... break your problem into manageable sub-problems. trying to learn everything at once isn't going to work.
so first things first.
1) get your PIC to run and send "Hello World" to the PC via the serial port. there are lots of examples on how to do this both here and in the CCS sample files. with this simple step you will have learned a great deal and verified that the PIC and the TTL/RS232 level translator (e.g. MAX232) are wired up and operating correctly.
2) get your PIC code to a) clear the EEPROM contents, b) write "Hello World 2" into the EEPROM, and then c) read out the EEPROM contents to the serial port and into the PC. as you can see this is building on the work above, and you are learning to read/write the EEPROM.
3) get your PIC to read a character from the serial port. there are a number of ways to do this, for you the easiest will be by polling the USART for a received char (see kbhit() for details). later you can work on interrupt driven methods but you are not there yet. once you get the PIC to capture a char, you can store it in EEPROM. then read it out of EEPROM and send it back to the PC.
4) combine elements of all of the above and you have your application.
note: there are a lot of implementation and operational problems which i've glossed over. for example, each EEPROM char write takes about 10ms. at 9600 baud, a char is arriving every ~1 ms. so if you send a string of chars to the PIC, you will overrun your ability to write to the EEPROM. at this point, you should be thinking "i need a buffer". right. similarly, the EEPROM in the midrange PICs is not all that large. you may be better off hanging an i2c-based serial EEPROM off of the PIC and using that as your storage device. this is straightforward and there are again many examples of how to do so.
jds-pic |
|
|
Guest
|
|
Posted: Fri Feb 20, 2004 2:57 pm |
|
|
This bootloader is written in CCS PIC C, accepts ASCII files from HyperTerminal, and modifies EEPROM (yes - as well as program memory). I think it would provide good insight into your project.
http://www.thebytefactory.com from the menu select Download | CodeLoader
Hope that helps |
|
|
|