Help with Pic Delay Pulse code please


Closed Thread
Results 1 to 37 of 37

Hybrid View

  1. #1
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hi Chris

    I have given it a try, and nothing happens,
    I get no errors on programming etc, but nothing.

    I have changed the control pins around as you have used a different orientation, wonder why this was? any reason,

    All looks fine as far as I can see.

    ?????

    Cheers
    Dave.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by g7jiq View Post
    Hi Chris

    I have given it a try, and nothing happens,
    I get no errors on programming etc, but nothing.

    I have changed the control pins around as you have used a different orientation, wonder why this was? any reason,

    All looks fine as far as I can see.

    ?????

    Cheers
    Dave.
    Not sure what you mean by a change in pin orientation? Could you explain what it was you neded to change.

    Chris

  3. #3
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hi Chris

    My pin out was

    InputTrigger var GPIO.0 ' Input normally HIGH, goes LOW to Trigger
    Output0 var GPIO.1 ' Normally high, goes low when triggered
    Output1 var GPIO.2 ' Normally high, goes low when triggered
    '

    You changed it to

    InputTrigger var GPIO.5 ' Input normally HIGH, goes LOW to Trigger
    InputReset var GPIO.2 ' Input normally HIGH, goes LOW to RESET
    OutputLine var GPIO.0 ' Normally HIGH, goes LOW when triggered
    Led var GPIO.1

    The pinouts in my circuit (GPIO.0 , 1, 2 ) were transposed to ( GPIO.5, 2, 0, 1 )
    The i/p and o/p are switched around, the trigger is on GPIO.0 you have it on GPIO.5, this is unused on my i/c, I also don't have a led (but I can add one tho if needed)



    Cheers
    Confused Dave..

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking

    Hi, G7

    Just think a while ...

    What you ask is to know IN ADVANCE if your input will be shorter or longer than 1 second ...

    You can't know that before the second is elapsed ...

    Just my two cents ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by g7jiq View Post
    Hi Chris

    My pin out was

    InputTrigger var GPIO.0 ' Input normally HIGH, goes LOW to Trigger
    Output0 var GPIO.1 ' Normally high, goes low when triggered
    Output1 var GPIO.2 ' Normally high, goes low when triggered
    '

    You changed it to

    InputTrigger var GPIO.5 ' Input normally HIGH, goes LOW to Trigger
    InputReset var GPIO.2 ' Input normally HIGH, goes LOW to RESET
    OutputLine var GPIO.0 ' Normally HIGH, goes LOW when triggered
    Led var GPIO.1

    The pinouts in my circuit (GPIO.0 , 1, 2 ) were transposed to ( GPIO.5, 2, 0, 1 )
    The i/p and o/p are switched around, the trigger is on GPIO.0 you have it on GPIO.5, this is unused on my i/c, I also don't have a led (but I can add one tho if needed)



    Cheers
    Confused Dave..

    Sorry Dave but, the code I used was the code in your original message, and pin assignements are clearly listed there the same as they were in my reply

    ' Define Hardware
    ' ---------------
    InputTrigger var GPIO.5 ' Input normally HIGH, goes LOW to Trigger
    InputReset var GPIO.2 ' Input normally HIGH, goes LOW to RESET
    OutputLine var GPIO.0 ' Normally HIGH, goes LOW when triggered
    Led var GPIO.1
    '

    The assignments in my reply are the same as in your first message on this thread. I can only think that your copy of the program has either merged together this file with another (Did yiou cut and paste ?) or something else is wrong.

    Either way I happy that my reply and your first message use the same pinouts, as you will see when you check for yourself

  6. #6
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hi Chris

    Beg your pudin, its been driving me mad for weeks, (I got in a right mess, thus the reason for the post on here)
    I did cut and paste (several times) I have about 9 versions of the code here.
    The mix up is I had cut pasted the original code from here for my 1st message,
    I had changed it around to match my circuit, both did work ok.
    (maybe I should had given up and gone down the pub)


    With a clear head I have re programed the pic,
    I have tried in my circuit and also bread boarded it.
    Here's what I get when powered up,

    GP0.0 high no change
    GP0.1 low no change
    GP0.2 high no change
    GPO.3 high no change
    GPO.4 high no change
    GPO.5 high/low trigger (i/p toggle)

    Your coding is re pasted below so you can check nothing was corrupted in the copy/past process.

    Cheers..

    '************************************************* ***************
    '* Name : UNTITLED.BAS *
    '* Author : Chris Barron *
    '* Notice : Copyright (c) 2009 Chris Barron *
    '* : All Rights Reserved *
    '* Date : 01/04/2009 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    '************************************************* * *************

    'G7JIQ MICRO LINK REPEATER
    'PIC 12F675
    'Internal RC clock
    '
    ' PIC Defines
    ' -----------
    @ DEVICE pic12F675, INTRC_OSC_NOCLKOUT
    ' System Clock Options (Internal)
    @ DEVICE pic12F675, WDT_ON
    ' Watchdog Timer
    @ DEVICE pic12F675, PWRT_ON
    ' Power-On Timer
    @ DEVICE pic12F675, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic12F675, BOD_ON
    ' Brown-Out Detect
    @ DEVICE pic12F675, CPD_OFF
    ' Data Memory Code Protect
    @ DEVICE pic12F675, PROTECT_OFF
    ' Program Code Protection

    '
    ' Define Hardware
    ' ---------------
    InputTrigger var GPIO.5 ' Input normally HIGH, goes LOW to Trigger
    InputReset var GPIO.2 ' Input normally HIGH, goes LOW to RESET
    OutputLine var GPIO.0 ' Normally HIGH, goes LOW when triggered
    Led var GPIO.1

    '
    ' Define Variables
    ' ----------------
    DelayTick var Byte ' 100mS Tick Counter
    myflags var byte
    '
    ' Initialise PIC
    ' --------------
    Reset:
    TRISIO=%00100100 ' Preset I/O
    CMCON=%00000111 ' Disable Comparators
    ANSEL=%00000000 ' Disable ADC
    DelayTick=100 ' Reset Counter
    myflags = 0
    high OutputLine ' Everything RESET



    ' Main Program Loop
    ' -----------------
    Loop:
    '
    ' Test for RESET
    ' --------------
    While InputReset=0 ' Just wait here if RESET
    high OutputLine ' Reset Output
    myflags = 0
    DelayTick = 100
    Wend

    ' We're using the lower 2 bits of the 'myflags' register to store the state of
    ' the input pin over the last two program loop iterations
    ' myflags.0 stores the current pin state and myflags.1 stores the previous
    'state.
    myflags.1 = myflags.0 ' Move the last 'current state' into the 'last state' bit
    myflags.0 = InputTrigger ' Store the current state

    ' By storing the two states we can detect the transition from high to low
    ' A high to low transition = 00000010 = decimal 2
    ' A low to high transition = 00000001 = decimal 1

    if myflags = 2 then
    DelayTick = 100 ' A high to low transition, reset the delay
    else
    if delaytick > 0 then delaytick = delaytick - 1
    endif

    pause 10 ' adjust to get the resolution required (10 x DelayTick = total hang time)

    if inputtrigger = 0 then low OutputLine; if input is active set output active

    if ((inputtrigger = 1) and (Delaytick = 0)) then high outputline

    goto loop:

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by g7jiq View Post
    Hi Chris

    Beg your pudin, its been driving me mad for weeks, (I got in a right mess, thus the reason for the post on here)
    It's alright Jeff,
    I am merely interested to know if it works or not, and if not, what is the problem and I will try to help to rectify it.

    Cheers
    Chris

  8. #8
    Join Date
    Oct 2007
    Posts
    35


    Did you find this post helpful? Yes | No

    Default

    Hi Chris

    Is there any updates yet, Have you got it working??

    Cheers...

Similar Threads

  1. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  3. Help writing pic program with i/p o/p hold delay
    By g7jiq in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th May 2008, 21:58
  4. Pic driven digital audio delay
    By skimask in forum Off Topic
    Replies: 12
    Last Post: - 19th April 2007, 20:42
  5. Memory Space of the PIC16F84...
    By Tear in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 1st July 2005, 19:55

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