OWOUT Glitch


Closed Thread
Results 1 to 8 of 8

Thread: OWOUT Glitch

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Angry Re: OWOUT Glitch

    More testing reveals if I just change one Alias and then change the output the program works or doesn't.

    ChargerMain var PORTA.6 'Charger Mains Relay Out (OWOUT Works)
    low ChargerMain 'This Works
    high ChargerMain 'This Works


    ChargerMain var LATA.6 'Charger Mains Relay Out (OWOUT Fails if I do either of the next lines)
    low ChargerMain 'This Fails
    high ChargerMain 'This Fails

    If I don't do HIGH or LOW OWOUT works.


    It's not even the same PORT or BIT the DS18B20 sensor is connected to PORTC.4

    I don't see any PIC internal connection or multiplexing/alternate functions etc between A.6 and C.4

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,705


    Did you find this post helpful? Yes | No

    Default Re: OWOUT Glitch

    ChargerMain var LATA.6 'Charger Mains Relay Out (OWOUT Fails if I do either of the next lines)
    low ChargerMain 'This Fails
    high ChargerMain 'This Fails
    not surprising at all. using pbp "high level" commands like HIGH,LOW is not allowable
    with LATX registers . its in the manual



    2.2.3 Use in High-Level Commands
    The data-direction is set automatically for most of the PBP high-level commands. If the command sends output, the pin is set for output. If the command reads the digital state of the pin, the pin will be set to input. PBP does not set the data-direction back to its original state after such commands are executed.
    Either the PORT.PIN designations or the aliases you have assigned may be used directly in PBP commands. For instance, there is no need to read a pin value to a variable before testing it. You can test an input pin directly with:
    IF switch = 0 THEN ' Check state of switch pin
    HIGH led1 ' LED on
    PAUSE 500 ' Delay 500mS
    LOW led1 ' LED off
    ENDIF
    I2CREAD PORTB.5, PORTB.4, $A0, location,[B_val]
    Note the use of the HIGH and LOW commands in the preceding example. These are considered high-level commands because they do more than just set the bit in the PORTx register. They also set the data-direction to output.
    Last edited by richard; - 17th April 2022 at 07:30.
    Warning I'm not a teacher

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: OWOUT Glitch

    But why does doing something wrong with PORTA LAT affect PORTC????

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,705


    Did you find this post helpful? Yes | No

    Default Re: OWOUT Glitch

    it doesn't, LOW lata.6 turns the PLL OFF as with HIGH lata.6

    porta address + 18 = trisa
    lata address + 18 = osctune on that chip [it varies]

    all pbp "high level" commands that set a pin direction use a fixed offset to get to the tris reg
    it simply will not work correctly from a LATx offset
    Warning I'm not a teacher

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: OWOUT Glitch

    Thanks that explains it..

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,705


    Did you find this post helpful? Yes | No

    Default Re: OWOUT Glitch

    using pbp "high level" commands with LATX registers is a great way to introduce hard to find bugs in your code
    5 stars
    Warning I'm not a teacher

Similar Threads

  1. NCO Glitch
    By mpgmike in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th December 2017, 16:30
  2. OWIN - OWOUT problem
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th November 2011, 20:22
  3. Owin / owout
    By pyrogeek in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd September 2011, 10:08
  4. help on OWIN and OWOUT fucntion
    By eddy45 in forum Code Examples
    Replies: 3
    Last Post: - 10th September 2010, 12:04
  5. can i slowdown owin and owout
    By Eugen in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 29th January 2005, 23:17

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