serial communication problem


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Posts
    5

    Default

    hi guys.. i still hv a problem..i just change my code..here's below

    INCLUDE "modedefs.bas"
    define FOSC 4
    define LCD_DREG PORTD
    define LCD_DBIT 4
    define LCD_RSREG PORTD
    DEFINE LCD_RSBIT 2
    define LCD_EREG PORTD
    define LCD_EBIT 3
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    'HIGH PORTD.1
    C VAR WORD


    TRISC = %10111111 ' Set TX (PortC.6) to out, rest in
    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $20 ' Enable transmit, BRGH = 0
    SPBRG = 25 ' 9600 Baud @ 0.16%
    SPBRGH = 0
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator


    define ADC_BITS 10
    define ADC_CLOCK 3
    define ADC_SAMPLEUS 50

    lmtemp var word
    temp var byte
    quanta con 1250
    TRISE = %111
    ADCON1 = 0


    MAIN:
    ADCIN 6, lmtemp
    temp = ((lmtemp/100)/2)+8-50
    'PORTD.1=1
    'C=PORTD.1
    'LOW PORTD.1
    LCDOUT $FE,1
    LCDOUT " Programmed by"
    LCDOUT $FE,$C0
    lcdout "YAN^S TEMP="
    LCDOUT #temp
    LCDOUT " C"
    'HIGH PORTD.1


    HSEROUT [dec temp,10]
    HSerout ["The Temp Are Now ",#temp,"C",13]


    pause 100
    GOTO MAIN
    end

    it will display something like this... xøxøxxxxø€øøøxxx€x€€ø€€øxøxxxxø€øøøxxx€

    is it correct my temperature equation??i think it is not..when i measured voltage, i get 0.81V and it's display 36 C..it suppose display 30 C..how analog voltage convert to digital and what exactly temperature equation to be write into my code??

    mcp9700 sensors is an analog signal that is directly proportional (linear) to the temperature and the output voltage is a direct indication of the temperature in 10mV/°C.

    plz help me..it's urgent..the due date is next week 15 march..
    thanx..

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default

    You should first scale lmtemp to volts

    Volts = Imtemp/205 [ 205 = 1/(5/1023))]

    Than since your sensor Vout = (Tci * Ta) + V0°C

    where: Tci = 10 milliVolts and V0°C = 0.5 Volts

    Ta= (Vout-0.5)/0.01

    Ta = (Vout - 0.5) * 100

    Ta = (Vout*100)-50

    Al.
    Last edited by aratti; - 8th March 2010 at 19:58.
    All progress began with an idea

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    Sounds like you need to invert the signal.
    You can use a MAX232 or a transistor with a couple resistors.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Replies: 18
    Last Post: - 4th July 2017, 15:26
  2. Replies: 5
    Last Post: - 20th March 2006, 02:34
  3. Serial Communication Problem
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 23rd February 2006, 03:11
  4. Problem in Serial Communication
    By uuq1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th June 2005, 08:17
  5. Replies: 8
    Last Post: - 11th November 2004, 21:08

Members who have read this thread : 0

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