Ports not working when using PORTA = %111111


+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member Dave-S's Avatar
    Join Date
    Sep 2004
    Posts
    281
    Thumbs Up
    Received: 7
    Given: 0
    Total Downloaded
    664.74 MB

    0 Not allowed!

    Default Ports not working when using PORTA = %111111

    Hi,
    Not sure what is happening. I upgraded to 3.7.0.6 with Procedure's and all seemed to be ok.
    I had an existing project which I needed to change, it uses steeper motors to dim lights, originally it controlled two lights and I needed to add a third light. Having done that when I run the program nothing works, the PORTA controls the on/off via relays and I notice the Led on port pin very dim when if fact at the start the code sets PORTA high.

    Code:
    PORTA = %111111
    Measuring the voltage it was 2.3 volts and not 5 volts.
    Adding this rectifies the problem.

    Code:
    High PORTA.0
      High PORTA.1
      High PORTA.2
      High PORTA.3
      High PORTA.4
      High PORTA.5
    Also the code to drive the Stepper motors did not work.

    Code:
    PORTB = %01000000
                             DelayMS I
                             PORTB = %00010000
                             DelayMS I
                             PORTB = %10000000
                             DelayMS I
                             PORTB = %00100000
                             DelayMS I
    Writing it like this works.

    Code:
     Low PORTB.3
                              Low PORTB.2
                              High PORTB.1
                              Low PORTB.0
                              DelayMS I
                              High PORTB.3
                              Low PORTB.2
                              Low PORTB.1
                              Low PORTB.0
                              DelayMS I
                              Low PORTB.3
                              Low PORTB.2
                              Low PORTB.1
                              High PORTB.0
                              DelayMS I
                              Low PORTB.3
                              High PORTB.2
                              Low PORTB.1
                              Low PORTB.0
                              DelayMS I
    I am using ports A for switching and B, C, D for driving Stepper motors and it is the same on all the ports. I have All_Digital set so why does % followed by the binary not work?
    Any idea's.

    Another minor problem, I use serial for debugging and I usually put "Serout PORTE.0, 84, ["Start", 13, 10]" at the start after a delay.
    But I now get gibberish *W5 if I repeat the "Serout PORTE.0, 84, ["Start", 13, 10]"
    I get


    *W5
    Start

    and serial output works ok then, do not know why the first serial output is gibberish, all worked ok before.

    David

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,431
    Thumbs Up
    Received: 104
    Given: 25
    Total Downloaded
    5.47 GB

    0 Not allowed!

    Default Re: Ports not working when using PORTA = %111111

    What PIC are you using?

    If using an 18F device try change PORTA to LATA and PORTB to LATB.
    Regards

    Joseph

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Senior Member Stephen Moss's Avatar
    Join Date
    Jan 2006
    Posts
    481
    Thumbs Up
    Received: 40
    Given: 7
    Total Downloaded
    3.34 GB

    0 Not allowed!

    Default Re: Ports not working when using PORTA = %111111

    The fact that writing each bit individually appears to solve the problem does suggest it may be a compiler issue but does not conclusively eliminate a device/design issue.

    Typically I would say there are three reasons for measuring a lower voltage, VI losses due to excessive power consumption or a DVM averaging out a PWMed or oscillating output.
    Does physically disconnecting the third stepper make a difference? If so that would suggest that excessive current draw rather than the compiler may be the problem.

    Are you using the same device or have you changed to a different one?
    Does commenting out the commands for the third motor make any difference?

    If it is the same device have you tried using an older compiler version (preferably the same as when originally written) to see it that makes a difference?
    If it does make that suggests that later changes to either the compiler or PPI file may have created an issue, if not and you are using an I/O port you were not using previously it may suggest an issues with the PPI file for the device or the device port itself.

    I see you are only setting 6 bits of PortA which I am sure would be an 8 bit register, personally I always use 8 bits as if I use less it always worries me that the compiler does not know if I mean the upper, lower of middle bits and as there should be no input buffers to the RO bits of the register those bits are ignored on a write. You could try changing to an 8 bit value to see if that makes a difference - probably a long shot but you never know.

    Finally I see you mentioned using All_Digital, I may be wrong but though this was no longer recommend as it does not always work for every device as well as being unnecessary as I believe the compiler now does it automatically. Personally, I always do it myself writing to the relevant registers as it does not take long, I have the reassurance of seeing it is done and the command is already there should I later need to make an input Analogue. You could try commenting out that command and/or writing to the relevant registers yourself to see if it makes a difference.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Prolific Poster See_Mos's Avatar
    Join Date
    Feb 2004
    Posts
    1,272
    Thumbs Up
    Received: 38
    Given: 0
    Total Downloaded
    872.27 MB

    0 Not allowed!

    Default Re: Ports not working when using PORTA = %111111

    Could be a problem with the TRIS register setting.

    Using the commands HIGH and LOW set the TRIS registers to output automatically but PORTA = % 1111 or LATA = % 1111 does not.
    Last edited by See_Mos; 8th March 2019 at 12:44.
    My RAM is failing

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Junior Member bugi's Avatar
    Join Date
    Nov 2018
    Posts
    3
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    308.24 MB

    0 Not allowed!

    Default Re: Ports not working when using PORTA = %111111

    Hi,

    You must sure to set PortA as digital. You say 2.3 volt, I think your ports work analog. You can look datasheet for setting which pic you use.

    LAT registers faster then PORT registers but you should use them only for data transfer like Lcd driving. Because LAT can supply only a few mA current. If you want to drive transistors or another, you should use PORT register for more current.

    Always use 8 bit definition.

    Finally, you can look at errata for your pic. If there is a fabric problem you can learn how to fix it or not.... And do not forget the open collector pin inside the PORTA

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    468
    Thumbs Up
    Received: 84
    Given: 0
    Total Downloaded
    330.54 MB

    0 Not allowed!

    Default Re: Ports not working when using PORTA = %111111

    It's not my intent to be rude, but you should pretty much ignore everything in post #5.

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,116
    Thumbs Up
    Received: 192
    Given: 173
    Total Downloaded
    4.82 GB

    0 Not allowed!

    Default Re: Ports not working when using PORTA = %111111

    I'd look into post #3 sounds like the hardware changes you've made sucking down the 5v rail.

    Do you use the same power supply for electronics and relay coils?
    George.

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Porta t0cki
    By joesaliba in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 29th October 2017, 19:20
  2. Project working at proteuse .... but not working at real
    By MedTronic in forum Projects discussion
    Replies: 5
    Last Post: 19th July 2013, 13:26
  3. [SOLVED !] 16F628A Porta as input not working
    By naga33 in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 9th December 2009, 12:33
  4. [SOLVED !] control PortA
    By jergata in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 8th December 2008, 13:18
  5. [SOLVED !] is there any difference between PortA.0 and PortA.1 for the 1-wire commands?
    By ccakmak in forum Proton Plus Compiler v3
    Replies: 14
    Last Post: 23rd February 2007, 16:47

Members who have read this thread since 3rd September 2019, 00:32 : 1

Actions :  (Set Date)  (Clear Date)

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