Many problems with programs that used to work


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116

    Default Many problems with programs that used to work

    Hi,

    I am having troubles recently. Programs that used to work ok are now behaving strangely, like certain lines of code being ignored, or so it seems. I may have only changed a pause time or something simple, but when compiled no longer work as expected. This started (though may be a coincidence) when I moved to windows 7 at work, PBP V2.5 did not seem to work, so I upgraded to PBP3, but still having problems. Here is an example.
    Code:
    goto start
    pulse:
    while pulseon = 1
    high pulses
    pauseus 100
    low pulses
    pauseus 100
    wend
    return
    
    start:
    if coil1 = 1 then
    thy1 = 1
    thy2 = 0
    thy3 = 0
    thy4 = 0
    endif
    
    if coil2 = 1 then
    thy1 = 0
    thy2 = 1
    thy3 = 0
    thy4 = 0
    endif
    
    if coil3 = 1 then
    thy1 = 0
    thy2 = 0
    thy3 = 1
    thy4 = 0
    endif
    
    if coil4 = 1 then
    thy1 = 0
    thy2 = 0
    thy3 = 0
    thy4 = 1
    endif
    
    if pulseon = 1 then gosub pulse
    
    goto start
    Now no matter which coil input is high, and when pulseon is low all the program will do is switch on thy1, and continually run the pulse subroutine.
    Here is another:
    Code:
    if lastgun = 3 then goto jmp3   'if it was last to be used then no need to 
                                              'send settings or change relays
    high coil3     ;switch on channel 3 relay
    low coil1     ;swirch off all others
    low coil2
    low coil4
    'load channel 3 settings ready to be sent to main card
    let ivalue = current3
    let tvalue = time3
    let gvalue = gas3
    let scvalue = sctime3
    gosub sendmain ' send the values
    pause 150
    jmp3:   'jump to here if this was last gun used
    let lastgun = 3 'set last gun flag
    Here the first line is always ignored, all of the rest of this quite large program works fine, and these programs used to work fine.
    I have tried changing chips, and PCBs so I know it cant be hardware faults, or blown chips.
    Anyone have any ideas?

    Regards
    Bob.

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


    Did you find this post helpful? Yes | No

    Default Re: Many problems with programs that used to work

    Hi, Bob

    one of PBP3 main changes is the CONFIG section change ...

    so, if you had shown us a FULL listing, probably we could have helped you some more ...

    BTW, I do not see any initialization section nor ... is "omission" decided by you ???

    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
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Many problems with programs that used to work

    Whenever I see several HIGH/LOW etc in a row I suspect Read-Modify-Write issue.
    Try inserting a Pause 10 between each row and see what happends. Also make sure you have analog functions (ADC and comparator) disabled on all pins since they will otherwise interfere.
    If it doesn't seem to help please also let us know which chip you're using.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: Many problems with programs that used to work

    Hi, Henrik

    I suppose you meant :
    Code:
    if coil1 = 1 then
    thy1 = 1
    thy2 = 0
    thy3 = 0
    thy4 = 0
    endif
    because there are no RMW issue when using HIGH and LOW ( as they include a TRIS command that takes some time ) ... tested "in live" with 3.5 µF loads ...

    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 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Many problems with programs that used to work

    I meant those too.
    I know HIGH/LOW includes the clearing the TRIS-bit and that it's less likely to get a RMW-issue using it. I probably wouldn't go so far to say that RMW is non existent though since it depends on the load and, obviously, on the clock frequency. What frequency did you run at when you tried a 3.5uF capacitve load? RMW-issues also exists (with and without HIGH/LOW) when the pin(s) isn't properly configured for digital I/O.

    /Henrik.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default Re: Many problems with programs that used to work

    Quote Originally Posted by HenrikOlsson View Post
    . What frequency did you run at when you tried a 3.5uF capacitve load? /Henrik.
    not more than 32 Mhz with a 16F628 and 80 Mhz with 18F chips ( NOT using LAT ! ) ... yess ! I made some hard overclocking tests ..

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

Similar Threads

  1. lost programs/programs rolled back
    By Chris Barron in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 10th February 2010, 00:22
  2. How to use TRIS on a ICD programs
    By timseven in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 10th August 2009, 01:12
  3. HELP W/programs
    By furmpf in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th February 2008, 13:45
  4. problems with I2C.... and ideas why dosent work?
    By snood in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 26th April 2005, 12:54
  5. Replies: 3
    Last Post: - 3rd September 2003, 12:05

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