Problems with 12F675


Closed Thread
Results 1 to 40 of 67

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    In your LAST version, you missed the LOW statement.
    Code:
    if but1=1 and rel2=0  then
             high rel1 
             pause 20
                              
             while but1=1
             call check
             wend
             pause 20
                                           
             while but1 = 0
             call check
             if rel1=0 then
                GOTO Btn1PressDone
    ;         pause 10
             endif
             wend
             LOW rel1
    
             while but1=1
             wend
             pause 20
    endif
    Btn1PressDone:
    DT

  2. #2
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    Thank You so much for help !
    I think this is my worst project ... I damage two PIC, now I have just one, and this project don't work, even with so much help...I write so many lines of code but nothing works right...
    This is the last version. Bugs:
    -if press but2, ON/OFF rel2 works fine, but if I press but1 after but2, then rel2 goes OFF and nothing works more, need to disconect power
    -if press but1, ON works, without OFF ; after OFF because of 'check' nothing works more, need to disconect power.
    This is one nightmare !!!
    Hope I don't became verry, verry boring...and I am really sorry about my english...
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by fratello View Post
    I think this is my worst project
    No arguments here.

    I guess it's the language barrier.

    I've built the circuit you described, and am using the following program ...
    As far as I can tell, it does exactly what you want it to do.
    Code:
    @ DEVICE PIC12F675, intrc_osc_noclkout, wdt_OFF, pwrt_on, mclr_off, bod_off
    
    DEFINE OSC  4
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50
    
    CMCON = 7
    OPTION_REG  = %10000110
    TRISIO  = %00011110
    ANSEL = %00011000
    ADCON0 = %10001101
    
    adval var Word
    vt var word
    but1 var gpio.3
    but2 var gpio.2
    rel1  var gpio.5
    rel2  var gpio.0
    
    
    main:
    rel1=0
    rel2=0
    
    btn1:
    
    if but1=1 and rel2=0  then
             high rel1 
             pause 20
                              
             while but1=1
             call check
             wend
             pause 20
                                           
             while but1 = 0
             call check
             if rel1=0 then
                GOTO Btn1PressDone
    ;         pause 10
             endif
             wend
             LOW rel1
    
             while but1=1
             wend
             pause 20
    endif
    Btn1PressDone:
    
    
    btn2:
    if but2=1 and rel1=0  then
             high rel2 
             pause 20
                     
             while but2=1
             call check
             wend
             pause 20                          
            
             while but2 = 0
             call check
             if rel2 = 0 then
               GOTO Btn2PressDone
    ;         pause 10
             endif
             wend
             low rel2  
             
             while but2=1
             wend
             pause 20
    endif
    Btn2PressDone:
       
    GOTO MAIN
    
    check:
    adcin 3, adval
     vt=adval * 5000
     vt=div32 1023
    
    if vt > 1250 then
    	gpio.0=0
    	gpio.5=0
    endif
    return
    
    end
    DT

  4. #4
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    Thanks for such a fast reply!
    Yes, in ISIS works verry, very fine ! But in real world ( ) the bugs are present !!!! I really don't know what something else I can do...

  5. #5
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Yes !!!

    This is it !
    Now works how I intend ! Thank You verry, verry much ! The on/off button works fine, and the check procedure too .I hope I write correct this "check procedure" for checking 5 times if is - indeed - overload (?!)
    One last problem : if press but1 and rel1 is high, how can made rel1 low, with but1 - press again, of course - OR BUT2 - press once... ?!? (and some things with but2/rel2).
    I try to write something, but rel1 go low AND rel2 go high...and this is unacceptable...Thanks again for attention and especially to Mr.Darrel for kindness and patience...
    Attached Files Attached Files
    Last edited by fratello; - 23rd July 2009 at 21:56. Reason: problems with language :(

  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 fratello View Post
    One last problem : if press but1 and rel1 is high, how can made rel1 low, with but1 - press again, of course - OR BUT2 - press once... ?!? (and some things with but2/rel2).
    I don't understand that.
    Relay1 and Relay2 can never be high at the same time.

    That's because of these statements...
    Code:
    if but1=1 and rel2=0  then
    If Relay2 is on, it won't accept a press of Button1.

    Or maybe I missed the point of the question.
    <br>
    DT

  7. #7
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    But1 make rel1 high at first push and low at second push.
    But2 make rel2 high at first push and low at second push.
    It is possible this :
    -but1 make rel1 high at first push and low when push second time but1 OR push but2 ?
    -but2 make rel2 high at first push and low when push second time but2 OR push but1 ?
    So, rel1 ON with but1 , and OFF with but1 OR but2 ; rel2 ON with but2, and OFF with but2 OR but1. Hope now You understand me;I am really verry sorry for my poor english...
    Thank You !


    ....me again. This is my working variant !
    In check: procedure I write this :
    if rel1 = 1 and but2 = 1 then
    low rel1
    pause 500
    goto Btn1PressDone:
    endif

    if rel2 = 1 and but1 = 1 then
    low rel2
    pause 500
    goto Btn2PressDone:
    endif
    In ISIS don't work, but in fact yes ! I don't understand why, but...Maybe You have another variant, much better; it's a good way to learn more. Still don't know if rel (1 or 2) stop if overload detected, only AFTER checking this overload for 5 times...
    Last edited by fratello; - 24th July 2009 at 07:14. Reason: ...not so young but restless ... ;)

Similar Threads

  1. 12F683 vs 12F675.
    By sccoupe in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th July 2009, 04:58
  2. LANC code 12F675
    By MikeDD in forum General
    Replies: 4
    Last Post: - 9th May 2008, 05:44
  3. 12F675 cant serout to PC
    By ruijc in forum General
    Replies: 9
    Last Post: - 3rd December 2007, 00:11
  4. USART problems
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 47
    Last Post: - 6th March 2005, 21:45
  5. Serial LCD on 12F675
    By anj in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 31st March 2004, 23: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