semaphore pic12f629


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    First we need to work on the schematic. The way it is drawn the red and green leds will never light up. Yellow is OK.

    You will also want it rigged so if a green is on the corresponding red at the other fixture will be off.

    Take a look here and see if you want to use a configuration something like the drawing with three pins (with a little tweaking)
    http://www.mackrackit.com/mac/www/dave/LED/LEDs.html
    Dave
    Always wear safety glasses while programming.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    First we need to work on the schematic. The way it is drawn the red and green leds will never light up. Yellow is OK.

    You will also want it rigged so if a green is on the corresponding red at the other fixture will be off.

    Take a look here and see if you want to use a configuration something like the drawing with three pins (with a little tweaking)
    http://www.mackrackit.com/mac/www/dave/LED/LEDs.html
    Hello,

    In this case would be activated sequentially outs GP4 and GP5 agree to the amendment that I made to the circuit.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    That is doable. If GP4 is LOW, making GP0 or GP1 or GP2 High will make the connected LED light. The same for GP5.

    Being I do not know the sequence you want them to light here is an idea.

    Your code will have the "blinking" sequence with multiple pauses. The value of the pauses will be held in a variable. A button will connect to GP3 as an interrupt. Every time the button is pushed the variable will increase by the amount you want. Once the highest value is reached the variable will reset to the lowest.

    Code:
    "VARIABLES
    X VAR WORD:Y VAR WORD:Z VAR WORD
    
    ON INTERRUPT GOTO MYINT
    INTCON=%10001000
    IOC = %00001000
    '##############
    'YOUR SEQUENCE
    '##############
    DISABLE
    MYINT:
    IF GPIO.3 = 1 THEN
        X = X * 10
        Y = Y ???
        Z = Z  ???
        pause 100
    IF  X =>  ? THEN X  =  ??
    IF  Y =>  ? THEN Y  =  ??
    IF  Z =>  ? THEN Z  =  ??
    INTCON.1 = 0
    RESUME
    ENABLE
    Maybe something like that will work for you.
    Dave
    Always wear safety glasses while programming.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    That is doable. If GP4 is LOW, making GP0 or GP1 or GP2 High will make the connected LED light. The same for GP5.

    Being I do not know the sequence you want them to light here is an idea.

    Your code will have the "blinking" sequence with multiple pauses. The value of the pauses will be held in a variable. A button will connect to GP3 as an interrupt. Every time the button is pushed the variable will increase by the amount you want. Once the highest value is reached the variable will reset to the lowest.

    Code:
    "VARIABLES
    X VAR WORD:Y VAR WORD:Z VAR WORD
    
    ON INTERRUPT GOTO MYINT
    INTCON=%10001000
    IOC = %00001000
    '##############
    'YOUR SEQUENCE
    '##############
    DISABLE
    MYINT:
    IF GPIO.3 = 1 THEN
        X = X * 10
        Y = Y ???
        Z = Z  ???
        pause 100
    IF  X =>  ? THEN X  =  ??
    IF  Y =>  ? THEN Y  =  ??
    IF  Z =>  ? THEN Z  =  ??
    INTCON.1 = 0
    RESUME
    ENABLE
    Maybe something like that will work for you.
    Hello,

    This is a sequence that desire for the lights.
    Attached Images Attached Images  

  5. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    You can accomplish the result with only 3 output ports. Connect Red led A and Green led B from port one to ground; Green led A and Red led B from port one to + 5V (pay attention to the polarity). Yellow led A to port 2 and Yellow led B to port 3. When Port one is High the green/red leds (correctly polarized will lit) when port one will turn low you will switch on the second set of green/red leds.
    With port 2 and 3 you modulate the yellows.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Leonardo View Post
    This is a sequence that desire for the lights.
    Are you sure about that sequence?

    Don't they normally go Green-Yellow-Red?
    DT

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Are you sure about that sequence?

    Don't they normally go Green-Yellow-Red?
    Darrel is the sequence .gif

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Leonardo View Post
    Darrel is the sequence .gif
    Yes, but it looks like it's backwards.

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2968" />
    DT

Similar Threads

  1. pic12f629 EEPROM problem in MPLABSIM
    By nicholastyc in forum General
    Replies: 1
    Last Post: - 16th May 2008, 18:10
  2. PIC12F629 - OSCCAL LOST in combat
    By ewandeur in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th March 2007, 21:06
  3. Ultrasound with PIC12F629
    By ewandeur in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th February 2007, 16:22
  4. PIC12F629, useing all I/O pins
    By Jcee324 in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 7th December 2004, 11:05
  5. PIC12F629 or 8pin
    By andyf in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 27th October 2004, 18:11

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