PBP3 Compilation problem


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: PBP3 Compilation problem

    Thanks Darell. While I have your attention, could you please have a quick glimpse and advise me of my mistake as I am struggling with it from last many days. My code only Debugs "TIME=0 & AMBIENT=0". The voltage on both Pins is set to 2.5volts, but I am not understanding why it is outputting 0 all the time.
    Code:
    ;-----------------PIC16F676---------------------------Include "modedefs.bas"
    DEFINE OSC 4
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50
    ;-------------CONFIGURATION FUSES SET HERE-------------------------
    #CONFIG
        ifdef PM_USED
            device  pic16F676, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
        else
            __Config _XT_OSC & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _BODEN & _CP & _CPD
        endif
    #ENDCONFIG
    
    
    
    
    '----------------------------------------
    DEFINE DEBUG_REG    PORTC
    DEFINE DEBUG_BIT    5
    DEFINE DEBUG_BAUD 2400
    DEFINE DEBUG_MODE 0
    
    
    '-------Analog Input--------------
    Poten        Var    PortA.1
    Ldr        Var    PortC.3
    '--------------------------------------
    
    
    Time        Var    Word
    Time1        Var    Word
    Counter    Var    Byte
    Ambient    Var    Word
    
    
    ;------REGISTERS SET --------
    PORTA=0
    PORTC=0
    TRISA = 0010
    TRISC = 1110
    OPTION_REG = 128
    PORTA=0
    PORTC=0
    CMCON=7
    ANSEL=000010
    ADCON1=110000
    ADCON0=000000
    '---------------------------------------
    
    
    Main:
            GoSub LoadTime
        Pause 1000
        GoSub LoadLight
        Pause 1000
    
    Goto Main
    
    
    
    
    LoadTime:
            ADCIN Poten,Time : Pause 10
            DEBUG "TIME=",DEC Time,13,10
    Return
    
    
    LoadLight:
            ADCIN Ldr,Ambient : Pause 10
            DEBUG "AMBIENT=",DEC AMBIENT,13,10
    Return
    ___________________
    WHY things get boring when they work just fine?

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: PBP3 Compilation problem

    Got it. Found my mistake. The program is working fine now. Just realized that, it can't be aliases but need to be channel number at the ADCIN.
    ___________________
    WHY things get boring when they work just fine?

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