Setting up digital inputs


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2008
    Posts
    8

    Default Setting up digital inputs

    I am trying to learn how to set up digital inputs in a 16f84a
    In the manual it gives CMCON =1 : ASCON1 = 7 : ANSEL = 0 to place at the beginning of the programme
    I have tried all of these but it comes up with message undefined symbol
    I would be grateful for any help.
    Thanks.
    This is the project from Chucks book but I am using a 16f84a instead.

    Init:
    adcon1 = 6 ' Set all PortA to digital I/O
    trisa = %00000001 ' set PortA RA4-RA1 to outputs, RA0 input
    porta = %00000010 ' Set PortA RA1 high to turn on LED1

    Main:
    ' *** Test the switch state ***
    if portA.0 = 0 then led2 'If switch is pressed then jump to LED2 routine

    PortA.1 = 1 ' Turn LED1 on
    portA.2 = 0 ' Turn LED2 off
    goto Main ' Jump to the top of the main loop

    LED2:
    '*** Turn LED2 on ***
    porta.2 = 1 ' LED2 on
    porta.1 = 0 ' LED1 off
    goto Main ' Jump to the top of the main loop

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by quester View Post
    I am trying to learn how to set up digital inputs in a 16f84a
    Check the 16F84A datasheet.
    Question #1 : How many Analog/Digital converter ports does the PIC16F84A have?
    Question #2 : What position in memory does the ADCON1 register occupy in the PIC16F84A's memory space?

Similar Threads

  1. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 14:01
  2. Digital Out on an A/D pin safe ?
    By mr.sneezy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st January 2009, 22:48
  3. PIC 18f4680 DIGITAL INPUTS
    By MegaADY in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th July 2008, 07:34
  4. Digital inputs are some pin NOT working (PIC18F458)
    By san6302 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th July 2008, 06:50
  5. Digital inputs
    By Christopher4187 in forum General
    Replies: 5
    Last Post: - 1st August 2007, 23:14

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