12f675 making me a crazy person


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Jerson,

    The only change I see in your suggestion is an "else" for the Chubb. That part of the code is the only part that works repeatedly....

    There is something whacked in the way the counter stuff is getting either compiled or put to the chip, or interpreted by the chip. That part is going off into lala land.

    Gary

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


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    Here is the V2.60 Answer :

    C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PROJETS\MERIACHEE.BAS ERROR Line 63: Syntax error.
    C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PROJETS\MERIACHEE.BAS ERROR Line 76: Syntax error.
    C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PROJETS\MERIACHEE.BAS ERROR Line 83: Syntax error.
    C:\PROGRAM FILES\MICROCHIP\MPLAB IDE\PROJETS\MERIACHEE.BAS ERROR Line 34: LOOP without a matching DO.Halting build on first failure as requested.
    BUILD FAILED: Wed Sep 16 09:47:12 2009
    Translated : Do not use " Loop " but "LoopA" ...

    No more error after changing " loop "



    Considering your program behaviour ...

    The IF THEN sequences looks highly Hazardous to me ...

    I'd recommend you to make it somewhat clearer ... but it's me !!!

    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 " !!!
    *****************************************

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    970


    Did you find this post helpful? Yes | No

    Default

    Gary,

    Can you add the following lines to your code and compile it with the PM assembler like this
    C:\PBP\PBPW.EXE -apm -p12F675 "C:\MAC\PIC PROGS\TEST\12f675.bas

    Code:
    @ device  INTRC_OSC_NOCLKOUT, WDT_OFF
    @ device  MCLR_OFF, PWRT_ON
    @ device  CPD_ON, PROTECT_ON
    This will embed the configuration into the HEX file. The way you have it now, I have simulated the code and find it is incrementing and repeating after 300. If you want the code to block per trigger of Chubb, you need to add the following to your trigger code

    Code:
        if Chubb = 0 then
            high trig
            if X < 11 then
                X = 12
                gosub cola
                while Chubb : wend    ' wait while Chubb is 1
            endif
        else
            low trig
        endif
    Good luck

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


    Did you find this post helpful? Yes | No

    Lightbulb

    Quote Originally Posted by Meriachee View Post
    Jerson,

    The only change I see in your suggestion is an "else" for the Chubb.

    Gary
    Not so sure ... you caught it !

    the "foto1" Label MUST end with a " GOTO " ...

    Lala land is the GOSUB result ...

    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
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Jerson,

    That won't work. The Chubb needs to be high or low irrespective of the Led.

    Alain,

    P&J, toast and jam, goSUB and return. Can't change one without the other. Code works like a charm. It may not be elegant, but I'm not charging myself very much for it either...

    Cheers
    Gary

  6. #6
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    970


    Did you find this post helpful? Yes | No

    Default

    Try this for the PM assembler. If you hold Chubb high, foto1 will fire repeatedly. Release Chubb and trig will go low

    Enjoy

    Code:
    @ device  INTRC_OSC_NOCLKOUT, WDT_OFF
    @ device  MCLR_OFF, PWRT_ON
    @ device  CPD_ON, PROTECT_ON
    
    DEFINE OSC 4
    ANSEL=%00000000
    CMCON=7
    trisio = %00000100
    
    ' Chubb input gpio.5
    ' Output to panel - Trig var gpio.2
    ' Photo Guy gpio.4
    input gpio.5
        Chubb var gpio.5
    output gpio.4
        Led var gpio.4
        low led
    output gpio.2
        Trig var gpio.2
        low trig
    
    'Variable for the photo guy
    x var word
        x = 10
        
    ' Test the photo guy
    PAUSE 2000
        HIGH LED
            PAUSE 250
        LOW LED
            PAUSE 250
        HIGH LED
            PAUSE 250
        LOW LED
    PAUSE 2000
    
    'start here
    loop:
        if Chubb = 0 then
            high trig
            if X < 11 then
                X = 12
                gosub cola
            endif
        else
            low trig
        endif
    
        if x > 11 then
            x = (x + 1)
        endif
    
        if x >= 300 then
            x = 10
        endif
    
        if x = 100 then
            GOTO foto1
        endif
    
    pause 100
    goto loop
    end
    
    
    foto1:
        high led
            pause 100
        low led
                pause 250
        high led
            pause 100
        low led
    goto loop
    
    cola:
        high led
            pause 100
        low led
    return
    end

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


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Meriachee View Post

    Code works like a charm.Gary
    Hi, Gary

    I did understand it was the reason for you to show it here ... sure !

    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Originally Posted by Meriachee

    Code works like a charm.Gary
    So you have it all figured out now? What did you do to fix it?
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    There was a goto a subroutine, and a return at the end of it. Funny how PBP doesn't understand that it was s'posta go back to where we left off.

    The panel got installed this afternoon, and after a small expected timing change to the photoguy, it works like a charm.

    Thanks for all the help.

    Gary

Similar Threads

  1. 12F683 vs 12F675.
    By sccoupe in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th July 2009, 05:58
  2. Instant Interupts with a 12f675
    By wlundonly in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th January 2008, 02:52
  3. 12F675 won't reprogram or erase
    By modifyit in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 19th May 2006, 06:07
  4. 12f675 serial pic2pic
    By tagan in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th March 2006, 23:55
  5. Multitasking 12F675 I/O
    By jpeakall in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th November 2003, 01:57

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