semaphore pic12f629


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    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

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Yes, but it looks like it's backwards.

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2968" />
    Darrel sequence can be changed later by now we can start the code to get an idea of the operation, which you suggest?.

    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    Well, ok.

    But I accept no responsibility for the resulting accidents.
    Code:
    @ device  INTOSCIO, WDT_OFF, PWRT_OFF, MCLR_OFF, PROTECT_OFF, CPD_OFF 
    DEFINE OSCCAL_1K 1
    
    Green         CON 5000             ; mS to show Green Light
    Yellow        CON 1000             ; mS to show Yellow Light
    Tcalibrate    CON 480              ; Adjust for loop timing accuracy
    ;---------------------
    Sequence      VAR BYTE             ; cycles through the 4 states
    TimeCount     VAR WORD             ; Counts down sequence time
    
    CMCON = 7                          ; Disable comparator
    GPIO   = %110000                   ; Start with all LED's off
    TRISIO = %001000                   ; Set LED ports to output
    
    ;---------------------------------------------------------------------------
    Main:
      FOR Sequence = 0 to 3
        LOOKUP2 Sequence,[ Green,  Yellow,  Green,  Yellow], TimeCount
        REPEAT                                                   ; Multiplex
          LOOKUP Sequence,[%100001,%100011,%100100,%100100],GPIO ;  Tr. Light #1
          PauseUS Tcalibrate
          LOOKUP Sequence,[%010100,%010100,%010001,%010011],GPIO ;  Tr. Light #2
          PauseUS Tcalibrate
          TimeCount = TimeCount - 1
        UNTIL TimeCount = 0
      NEXT  Sequence
    GOTO Main
    Last edited by Darrel Taylor; - 4th November 2008 at 03:24. Reason: added OSCCAL_1K
    DT

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


    Did you find this post helpful? Yes | No

    Smile Whew

    Pleeeeeeease don't install these traffic lights in Colorado.

    My wife thinks;

    Green = go
    Yellow = go really fast
    Red = stop if you can

    Would really screw up the natural order of things..;o}
    Regards,

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

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Pleeeeeeease don't install these traffic lights in Colorado.

    My wife thinks;

    Green = go
    Yellow = go really fast
    Red = stop if you can

    Would really screw up the natural order of things..;o}
    Bruce,

    It is just an example of operation.

    Thank you

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Well, ok.

    But I accept no responsibility for the resulting accidents.
    Code:
    @ device  INTOSCIO, WDT_OFF, PWRT_OFF, MCLR_OFF, PROTECT_OFF, CPD_OFF 
    DEFINE OSCCAL_1K 1
    
    Green         CON 5000             ; mS to show Green Light
    Yellow        CON 1000             ; mS to show Yellow Light
    Tcalibrate    CON 480              ; Adjust for loop timing accuracy
    ;---------------------
    Sequence      VAR BYTE             ; cycles through the 4 states
    TimeCount     VAR WORD             ; Counts down sequence time
    
    CMCON = 7                          ; Disable comparator
    GPIO   = %110000                   ; Start with all LED's off
    TRISIO = %001000                   ; Set LED ports to output
    
    ;---------------------------------------------------------------------------
    Main:
      FOR Sequence = 0 to 3
        LOOKUP2 Sequence,[ Green,  Yellow,  Green,  Yellow], TimeCount
        REPEAT                                                   ; Multiplex
          LOOKUP Sequence,[%100001,%100011,%100100,%100100],GPIO ;  Tr. Light #1
          PauseUS Tcalibrate
          LOOKUP Sequence,[%010100,%010100,%010001,%010011],GPIO ;  Tr. Light #2
          PauseUS Tcalibrate
          TimeCount = TimeCount - 1
        UNTIL TimeCount = 0
      NEXT  Sequence
    GOTO Main
    Darrel,

    You notice how it works.

    Thank you

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Well, ok.

    But I accept no responsibility for the resulting accidents.
    Code:
    @ device  INTOSCIO, WDT_OFF, PWRT_OFF, MCLR_OFF, PROTECT_OFF, CPD_OFF 
    DEFINE OSCCAL_1K 1
    
    Green         CON 5000             ; mS to show Green Light
    Yellow        CON 1000             ; mS to show Yellow Light
    Tcalibrate    CON 480              ; Adjust for loop timing accuracy
    ;---------------------
    Sequence      VAR BYTE             ; cycles through the 4 states
    TimeCount     VAR WORD             ; Counts down sequence time
    
    CMCON = 7                          ; Disable comparator
    GPIO   = %110000                   ; Start with all LED's off
    TRISIO = %001000                   ; Set LED ports to output
    
    ;---------------------------------------------------------------------------
    Main:
      FOR Sequence = 0 to 3
        LOOKUP2 Sequence,[ Green,  Yellow,  Green,  Yellow], TimeCount
        REPEAT                                                   ; Multiplex
          LOOKUP Sequence,[%100001,%100011,%100100,%100100],GPIO ;  Tr. Light #1
          PauseUS Tcalibrate
          LOOKUP Sequence,[%010100,%010100,%010001,%010011],GPIO ;  Tr. Light #2
          PauseUS Tcalibrate
          TimeCount = TimeCount - 1
        UNTIL TimeCount = 0
      NEXT  Sequence
    GOTO Main
    Hello friends,

    Upss was wrong with the sequence of lights here correct.

    Attached Images Attached Images  
    Last edited by Leonardo; - 5th November 2008 at 01:23.

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Well, ok.

    But I accept no responsibility for the resulting accidents.
    Code:
    @ device  INTOSCIO, WDT_OFF, PWRT_OFF, MCLR_OFF, PROTECT_OFF, CPD_OFF 
    DEFINE OSCCAL_1K 1
    
    Green         CON 5000             ; mS to show Green Light
    Yellow        CON 1000             ; mS to show Yellow Light
    Tcalibrate    CON 480              ; Adjust for loop timing accuracy
    ;---------------------
    Sequence      VAR BYTE             ; cycles through the 4 states
    TimeCount     VAR WORD             ; Counts down sequence time
    
    CMCON = 7                          ; Disable comparator
    GPIO   = %110000                   ; Start with all LED's off
    TRISIO = %001000                   ; Set LED ports to output
    
    ;---------------------------------------------------------------------------
    Main:
      FOR Sequence = 0 to 3
        LOOKUP2 Sequence,[ Green,  Yellow,  Green,  Yellow], TimeCount
        REPEAT                                                   ; Multiplex
          LOOKUP Sequence,[%100001,%100011,%100100,%100100],GPIO ;  Tr. Light #1
          PauseUS Tcalibrate
          LOOKUP Sequence,[%010100,%010100,%010001,%010011],GPIO ;  Tr. Light #2
          PauseUS Tcalibrate
          TimeCount = TimeCount - 1
        UNTIL TimeCount = 0
      NEXT  Sequence
    GOTO Main
    Hummm,

    The code works very well but I want to change the sequence of image.

    How can I change the code with this sequence.


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


    Did you find this post helpful? Yes | No

    Default

    Just change the numbers in the LookUp's.

    LOOKUP Sequence,[%100001,%100011,%100100,%100100],GPIO ; Tr. Light #1
    Code:
        %100001
         || |||
         || ||Red
         || |Yellow
         || Green
         |0=Tr.Light #1
         0=Tr.Light #2
    DT

  10. #10


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by Darrel Taylor View Post
    Just change the numbers in the LookUp's.

    LOOKUP Sequence,[%100001,%100011,%100100,%100100],GPIO ; Tr. Light #1
    Code:
        %100001
         || |||
         || ||Red
         || |Yellow
         || Green
         |0=Tr.Light #1
         0=Tr.Light #2
    Darrel excellent works ok, I will add other features and when they finish the code public.

    Thank you very much

  11. #11


    Did you find this post helpful? Yes | No

    Default

    Ready already got!.
    Last edited by Leonardo; - 5th November 2008 at 23:43.

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


    Did you find this post helpful? Yes | No

    Default

    I didn't see that you edited your post.
    Oh well, I needed the Flash practice anyway.

    <OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="600" HEIGHT="400" ><PARAM NAME="MOVIE" VALUE="http://www.pbpgroup.com/files/TrafficLight.swf"><PARAM NAME="PLAY" VALUE="true"><PARAM NAME="LOOP" VALUE="true"><PARAM NAME="QUALITY" VALUE="high"><EMBED SRC="http://www.pbpgroup.com/files/TrafficLight.swf" WIDTH="600" HEIGHT="400" PLAY="true" LOOP="true" WMODE="opaque" QUALITY="high" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>
    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