pbp bug or incompetence?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171

    Default pbp bug or incompetence?

    I'm trying to write some code for an 18f8722 but am having some problems. If I say

    PORTA.0 = 1
    Pause 1000
    PORTA.3 = 1

    Port A.0 turns on then a second later Port A.3 turns on and port A.0 turns off - It works if I say

    PORTA.0 = 1
    pause 1000
    PORTA = 9

    But that's not really what I'm wanting to do. Here's some cutting and pasting of code - After I had the issue I wrote the simple code above to see what would happen and it does the same thing.

    DEFINE OSC 10


    TRISA = %00000000
    TRISB = %00000000
    TRISD = %11111111
    TRISH = %00000000
    TRISJ = %00000000
    PORTA = 0
    PORTH.0 = 0
    PORTJ = 0
    CMCON = 7 'DISABLE COMPARITOR
    ' RAM Assignments and Variables
    ' -----------------------------
    RELAYS var PORTA
    Retract Var PORTA.0
    Extend var PORTA.1
    MtrPwr var PORTA.3

    ***Blah Blah Blah***

    BatchStart:

    mtrpwr = 1
    stepmtr = 1 'activate valve stepper
    stepdir = 0 'open valve
    steps = valveopen
    gosub stepdrive
    stepper = 0
    for b1 = 0 to InjectTime
    pause 10
    if estop = 0 then Emergstop
    next b1

    stepdir = 1 'close valve
    gosub stepdrive
    stepper = 0

    extend = 1
    stepmtr = 2 'full flow
    stepdir = 0
    steps = fullspeed
    stepper = 0 'de-energize coils
    for b2 = 0 to 1000
    if compactreed = 0 then Compact
    pause 10
    if estop = 0 then Emergstop
    next b2

    goto error1

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Code:
    PORTA.0 = 1
    Pause 1000
    PORTA.3 = 1
    You need to set the ports as digital ... add

    ADCON1 = $0F

    I would also suggest using the latches instead of setting the ports directly (but not the cause of your troubles). CMCON POR defaults to 7 so you do not need to set it unless you want to be sure.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  3. #3
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171


    Did you find this post helpful? Yes | No

    Default

    Ahhhh - so incompetence then, I did think that was more likely to be the case! Thanks heaps for your help - it's not an issue I've come across before, Cheers

  4. #4
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Exclamation

    Just read about the LAT-registers in 18F-devices !!!!!!!!
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. BUG IN PBP 2.50 & 2.50A pic16F688 ??
    By FRANCISCOGIM in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 12th June 2008, 02:42
  3. PBP bug ???
    By boban in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th March 2008, 16:30
  4. PBP & 16F690 bug?
    By Ron Marcus in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th May 2006, 23:18
  5. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 19:01

Members who have read this thread : 1

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