Thread: Need help with c programming!!

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    3

    Need help with c programming!!

    i have to program my pic16f887 to read a temperature from a (AD590) and display the temp on hyper terminal..

    i dont even know where to start and if anyone could lend a hand it would be SUPER appreciated!

    Thanks

  2. #2
    Registered User
    Join Date
    Oct 2011
    Location
    Denmark
    Posts
    80
    I think a good place to start would be to read the datasheet, for both your components! (the other datasheet)
    HomePort : A C Web Service API for heterogeneous home automation systems

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    1. first write,compile and execute a 'hello world' program that you can run and see the output from hyperterminal. there should be an example of some kind that comes with the pic tools.
    2. write a placeholder function 'readTemp' and have it just return a fixed value of the type you want (float,int,whatever). don't worry about the hardware yet. add that to your hello world program and print the value returned from that function instead of 'hello world'.
    3. modify the readTemp function to read a hardware register.there has to be an example in the PIC documentation for how to read and write to I/O ports. don't worry about the A/D yet. just determine that you can read and write I/O ports in whatever way is simplest.
    4. do what Tibo-88 said. read the data sheets. reading from an A/D usually takes a few steps of writing to output ports and reading input ports. after completing those steps, you will probably get an 8 bit binary number that represents the raw temperature value in whatever scale the chip outputs. a lot of times we call this value 'counts'. each 'count' will represent some temperature value.
    5. if necessary, scale the output to what you want (C or F) and return that value from the function so the main program prints it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 12-11-2011, 04:25 PM
  2. About Device Driver Programming And Socket Programming
    By pritesh in forum Linux Programming
    Replies: 6
    Last Post: 01-23-2010, 03:46 AM
  3. small programming job VCPP / Object Oriented Programming
    By calgonite in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 01-04-2006, 11:48 PM
  4. Total newb to programming here... Question about the many programming languages. Ty!
    By tsubotakid1 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 10-05-2003, 10:32 AM