Serin serout problem


Results 1 to 40 of 337

Threaded View

  1. #30
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    ok , I have a problem now:

    i wrote this program below, I configured so it read porta.0, but I get 0 output when I ground it and oscillation between 890 and to 900 when i put it to Vdd.
    if I leave the program as is, and just put the input wire to portA.1 theni get 0 output when i groud the wire, and 1023 when I put it to Vdd.
    Why am I getting a better result to a non configured port 6, at least i am ot calling this pin ??
    my ADCON0 = %10000001 i believe this is for An0 to input
    I am also trying to get two input for A/d , is that possible ?

    'RECEIVE PIC
    INCLUDE "modedefs.bas"


    DEFINE OSC 20 'use external 20mhz crystal
    DEFINE LCD_DREG PORTB ' Set LCD Data port
    DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
    DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTB ' Set LCD Enable port
    DEFINE LCD_EBIT 0 ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2500
    'DEFINE LCD_DATAUS 250
    'DEFINE CHAR_PACING 2000
    pause 1000

    ' Define ADCIN parameters
    Define ADC_BITS 10 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS

    input1 var word : input2 var word

    TRISA = %11111111 ' Set PORTA to all input
    CMCON = 7
    ANSEL = %00001100
    ADCON1 = %10000010
    ADCON0 = %10000001

    Pause 500

    loop: ADCIN porta.0, input1

    Lcdout $fe, 1 ' Clear LCD
    Lcdout "Value1: ", DEC input1 ' Display the decimal value
    lcdout $FE,$C0, "Value2: ", dec input2
    Pause 200

    Goto loop
    End


    Also, what do you mean by : Spare pin to resistor ?
    Last edited by lerameur; - 3rd January 2007 at 00:32.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  3. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 19:44
  4. Replies: 11
    Last Post: - 13th July 2005, 19:26
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

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