Programming the 18F1320 using C

Status
Not open for further replies.

GreenP

New Member
Hi
Could someone please give me a hand as I'm lost, I have been given a section of raw C code and been told to adapt it to operate on a 18F1320, what I don't understand is that within the code is a scanf function as well as an input file named in.dat which comprises of an array of numbers, where does the input to the system come from? here is the code I have been given along with the in.dat file (edited out) and the expected results.
Thanks
GreenP
 

Attachments

  • convert.txt
    5.4 KB · Views: 141
Well for starters, the code will not run on a 18F1320 as is. There are several reasons: No #pragma CONFIG is defined. The 18F1320 only has 256 bytes of RAM so the following variable just won't fit:
char instring1[1024]
As you guessed, there is no native file system on a PIC nor a console. I think, by default, the stdio functions like printf use the UART on the PIC so that would need to be configured also. Never tried it myself.
You'd really have to ask your instructor what the source of input is to be. ie: Are you going to have a keyboard attached to the PIC or receive commands via the UART, etc? Same goes for the data output.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…