need help first time user of picmicro


Closed Thread
Results 1 to 3 of 3
  1. #1
    tekdavid's Avatar
    tekdavid Guest

    Unhappy need help first time user of picmicro

    i have to use a pic 16f84a to make a program like the game simon says leds 1 - 4 light up in a random order the you enter the squence back to it but i im have problems using the button comand

    can any help me


    b5=0
    L2:
    button 7,0,0,4,B5,1,L4
    L4:
    IF PIN7 = 0 THEN LO


    LO:
    high 3
    PAUSE 1000
    LOW 3
    goto L2

  2. #2


    Did you find this post helpful? Yes | No

    Default

    here's a link to a complete project
    http://www.talkingelectronics.com/Pr...n/SimonP1.html

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


    Did you find this post helpful? Yes | No

    Default

    i never use Button statement. I prefer to use IF THEN or While Wend statement


    Code:
    TRISA=255
    TRISB=0
    
    IF PORTA.0 then ' if push button on PORTA.0 is pressed
         PORTB.0=1 ' set PORTB.0 to 1
         while PORTA.0 ' wait untill push button is release
         wend
         pause 50 ' debounce delay
    endif
    Be sure you refer to the great PIN... what your PIN statement refer to? Use the pin name make your code more readable or use alias

    Code:
    PushButton1 var PORTA.0
    
    if PushButton1 then
       ' do something here
    endif
    Last edited by mister_e; - 29th March 2005 at 04:42.
    Steve

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

Similar Threads

  1. 12F629 LDR - Light Dependant Resistor
    By Dennis in forum Schematics
    Replies: 15
    Last Post: - 18th February 2010, 22:33
  2. User Position, Velocity & Time II (D1h)
    By dj.lambert in forum GPS
    Replies: 2
    Last Post: - 31st July 2009, 09:21
  3. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55
  4. Some initial help for a first time PBP user
    By jtburnham in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th April 2006, 07:32
  5. Timer in real time
    By martarse in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th July 2005, 14:24

Members who have read this thread : 1

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