DIP switch select delay


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    If dip1 = 1 and dip2 = 1 and dip3 = 1 and dip4 = 1 then
    pause 8000
    else
    if dip1 = 0 etc.



    endif

    or
    something var byte
    something = porta &%00111100
    if something = 60 then
    pause 8000
    else
    if something = etc.

    endif

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    It might help if someone knew what DIL 18 was.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    it's a 18 pins device with a DIL package I'll bet it's a black one
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4


    Did you find this post helpful? Yes | No

    Default Might not be black

    Some are dark brown. Some even have writing on them - I wonder what this one is?

    Another clueless student trying to fudge a class project by the looks of it.

  5. #5
    Join Date
    Nov 2007
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Yes it's 16F88 .. and it's 18pin... BLACK in color comes with some wording on top of it!! but I use my finger's to rub it off anyway.. and now it's unknown chips , so I put DIL18

    Thanks mat janssen , this is what I've done first... I'm sure somewhere must have coded wrongly.. I'll check tonite again!

    Thanks!

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Something like this is where LOOKUP2 comes in handy.
    Code:
        @ DEVICE PIC16F88, WDT_OFF,INTRC_OSC,MCLR_OFF,BOD_ON,LVP_OFF,PWRT_ON,PROTECT_OFF
    
        DEFINE  OSC 8
        DEFINE  NO_CLRWDT 1
        OSCCON  = %01110000 ' 8MHz
        CMCON   = 7	        ' disable analog comparators
        ANSEL   = 0         ' disable A/D module, all digital
        X VAR WORD
        Index VAR BYTE
    
        LED VAR PORTB.0    
        TRISA = %00111100   ' RA2 to RA5 inputs for DIP switch
        PORTB   = 0
        TRISB   = %11111110 ' RB0 for LED
        OPTION_REG = %11111111
        
        WHILE OSCCON.2 = 0  ' wait for internal osc stable before moving on
        WEND
        
    Main:
        Index = (PORTA >> 2) & $0F ' Read DIP switch AND mask result
        LOOKUP2 Index,[200,300,400,500,600,700,800,900,1000,2000,_
        3000,4000,5000,6000,7000,8000],X
        HIGH LED
        PAUSE X
        LOW LED
        PAUSE X
        GOTO Main
    
        END
    Change the delay periods in the table to suite your app.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Nov 2007
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Thanks Bruce!

    your code helps alot, and it looks much simpler then what I've done... thanks again!

Similar Threads

  1. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. RF Transmitter
    By et_Fong in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th October 2005, 16:34
  4. Memory Space of the PIC16F84...
    By Tear in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 1st July 2005, 19:55
  5. Problem with saving to EEPROM...
    By Tear in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st July 2005, 00:10

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