PIC16F628A input question


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hi Yankee. You can do it simply with your code. The following assumes porta is held high and your input switches have common negative. Portb.0 controls operation1. Portb.1 controls operation2.

    START:
    LOW PORTB.0 'cancel operation1
    LOW PORTB.1 'cancel operation2
    IF PORTA.0 = 0 THEN OPERATION1 'ignore switch #2 but if #1 switch on do operation1
    GOTO START

    OPERATION1:
    IF PORTA.0 = 1 AND PORTA.1 = 1 THEN START 'both switches off cancel both operations
    HIGH PORTB.0 'do operation 1
    IF PORTA.1 = 0 THEN OPERATION2 '#2 switch on do operation2
    GOTO OPERATION1

    OPERATION2:
    LOW PORTB.0 'cancel operation1
    HIGH PORTB.1 'start operation2
    IF PORTA.1 = 0 THEN OPERATION2 'ignore #1 switch & stay here if #2 switch on
    GOTO START 'switch #2 off go home

  2. #2
    yankee's Avatar
    yankee Guest


    Did you find this post helpful? Yes | No

    Default

    OK, I'll try that out!

    I'll tell you what, it isn't easy going from strictly analog for 25 years to digital. Maybe this old dog can learn some new tricks.

    Thanks!

Similar Threads

  1. Replies: 8
    Last Post: - 22nd July 2008, 21:31
  2. Question from New member A/D input 16f876
    By mbruno in forum General
    Replies: 2
    Last Post: - 26th January 2008, 15:52
  3. Remote PIC input question
    By Adrian in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st September 2007, 16:44
  4. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 02:50
  5. input command (newbie question)
    By kctan in forum mel PIC BASIC
    Replies: 2
    Last Post: - 24th November 2005, 07:20

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