Send float to pc


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Posts
    37

    Default Send float to pc

    I am trying to send my analog input data to a pc in float format. I am using an LM34 which sends 10mV/C to my analog input. I use the PIC12F675 to receive the value from the LM34 then send this to a pc. It seems to work fine but I need to display one more decimal place. Example 45.6

    Here is my code:
    ' Connect analog input to GP0
    ' Internal VRef at VCC 3.3v 10000001

    adval VAR WORD 'Create adval to store result

    ANSEL = %00110001 ' Set ADC clock to Frc and GP0 to analog mode
    ADCON0 = %10000001 ' Configure and turn on A/D Module:
    ' Right justify result, use Vref pin, channel 0
    loop:
    ADCON0.1 = 1 'Start Conversion

    notdone:

    IF ADCON0.1 = 1 Then notdone 'wait for low on bit-1 of ADCON0,

    adval.highbyte = ADRESH 'move HIGH byte of result to adval
    adval.lowbyte = ADRESL 'move LOW byte of result to adval

    adval = (adval */ 330)>>2

    SerOut2 GPIO.5,84, ["Celsius: ", DEC adval.highbyte, ".", DEC adval.lowbyte, 10, 13]

    Pause 3000 'Wait .1 second
    GoTo loop 'Do it forever
    end

    Should this work?
    SerOut2 GPIO.5,84, ["Celsius: ", DEC adval.highbyte, ".", DEC adval.lowbyte, 10, 13]

    What am I doing wrong? I must complete this by tomorrow so any help would be greatly appreciated!

    Thanks,
    Scott

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    When in doubt, go to the expert.

    http://www.rentron.com/PicBasic/LM34.htm

    DT

Similar Threads

  1. Send binary file to pic over pc serial port
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 3rd May 2011, 13:47
  2. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  3. Send data PIC to PC
    By konter in forum Off Topic
    Replies: 6
    Last Post: - 25th December 2009, 22:04
  4. Send data to PC USB
    By konter in forum Off Topic
    Replies: 2
    Last Post: - 18th December 2009, 21:57
  5. Replies: 5
    Last Post: - 6th September 2007, 04:59

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts