Helpful ReplyHot!PORT RA4 OUTPUT of PIC18F26K22....

Author
ranpak1
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2008/11/26 11:28:42
  • Location: 0
  • Status: offline
2013/04/10 12:34:16 (permalink)
0

PORT RA4 OUTPUT of PIC18F26K22....

Smile Greetings MicroChip fans.... Smile
Help! ... I have a program using PORTA bit 4 of a PIC18F26K22 MCU for digital output....
I've done several projects, multiple board builds, all using this pin as a standard digital input... NO PROBLEM! ...
However, I have a new project, using this pin as output, and strangely (!!!!) almost 25 percent of the boards built seem to have erratic behaviour of this output.... The output is low when it should be high.... As I say, most parts, no problem! ... I can not explain it???... I understand how this pin is shared by C1OUT, SRQ, and T0CKI ....
 
In my "init function" ->  PMD1 = 0xFF;   SRCON0 = 0;   PWM1CON = 0;    SRCON1 = 0;   CCP1CON = 0;  ....
( I think this should be enough to disable these other pin functions? .... )
 
As I say, when we see this erratic behaviour in our test, we've swapped out the part for a new one, and the behaviour goes away?! .... Any suggestions? .... Anyone else seen a problem with this pin/output? .... The output is driving a 10 K ohm resistor to an input of a 74HC00 gate ... That's all! ... No high current, no board short, nothing! .... Strange! ... Seems like an internal MCU issue....

Be seeing you...
#1
DarioG
farewell.
  • Total Posts : 53177
  • Reward points : 0
  • Joined: 2006/02/25 08:58:22
  • Location: porcodioland
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... 2013/04/10 14:17:59 (permalink)
0
Strange... but do they break after some time of normal use?

forget about me, subhumans. adieu

if only this planet would detonate...
#2
ranpak1
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2008/11/26 11:28:42
  • Location: 0
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2013/04/11 05:47:28 (permalink)
0
SmileGreetings Dario! ....
It does not happen immediately (for example during my initialization activities... We see this immediately after programming when testing the boards..... ) .... It happens during my "main loop" of activities.... (Possible interrupt activity? ... Another pin function over ride of the pin? .... )
 
I neglected a full initializing of "TIMER0 MODULE" ... I notice "T0CS = 1 -- Transition on T0CKI pin" .... Does this change the TRIS bit high? ... The default for T0CON is 0xFF, which means it is ON.... I did issue "T0CONbits.TMR0ON = 0" during my init ... Any suggestions? ...
#3
WaltR
Super Member
  • Total Posts : 3759
  • Reward points : 0
  • Joined: 2003/11/07 12:38:21
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2013/04/11 06:13:30 (permalink)
-1 (1)
Just a guess:
It sounds like it could be an un-initialize register or variable that powers up with a random value. Some PICs power up with a '1' others with a '0'.
Recheck that every register and variable is initialized and don't rely on default values.
#4
DarioG
farewell.
  • Total Posts : 53177
  • Reward points : 0
  • Joined: 2006/02/25 08:58:22
  • Location: porcodioland
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2013/04/11 06:17:10 (permalink)
-1 (1)
Hi Smile
Well no, TRIS is not hit by other flags... should not...

forget about me, subhumans. adieu

if only this planet would detonate...
#5
ranpak1
Starting Member
  • Total Posts : 41
  • Reward points : 0
  • Joined: 2008/11/26 11:28:42
  • Location: 0
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2013/04/15 09:24:33 (permalink)
+2 (1)
A BIG THANK YOU guys for listening and the helpful suggestions!....
TURNS out the problem was an unitialized ram variable that was throwing the logic off! .... UGH! ...
Thanks again! .....
#6
WaltR
Super Member
  • Total Posts : 3759
  • Reward points : 0
  • Joined: 2003/11/07 12:38:21
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2013/04/15 11:29:29 (permalink)
+2 (1)
Ok.
#7
ShierSolutions
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2015/11/11 11:45:26
  • Location: 0
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... [SOLVED] 2017/07/17 12:26:56 (permalink)
0
I'm having the same problem on multiple units. I'm using MCC to configure everything. Only RA4 is not working (other outputs work fine) and is always high. I even attempted a test where I set RA4 low and then changed it to an input pin, but it is still high at that point.
 
I'm using MPLAB X V3.60, MCC 3.26.4 and XC8 V1.41.
 
Note that I ran a test using an PIC18F25K50 on a prototype board and it worked fine.
post edited by ShierSolutions - 2017/07/18 07:27:02
#8
jack@kksound
code tags!
  • Total Posts : 2145
  • Reward points : 0
  • Joined: 2014/05/14 10:03:19
  • Location: 0
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2017/07/17 14:02:14 (permalink) ☄ Helpfulby ShierSolutions 2017/07/17 14:04:47
+1 (1)
Post your test code (all of it), maybe that will help....
Also this is a 4 year old thread, might have been better to start a new one....
#9
ShierSolutions
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2015/11/11 11:45:26
  • Location: 0
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2017/07/17 14:03:15 (permalink)
0
I did some further investigation and discovered that CCP5_Initialize() is interfering with the use of RA4. If I comment out the call to CCP5_Initialize() in SYSTEM_Initialize(), then RA4 works.
 
void CCP5_Initialize(void)
{
    // Set the CCP5 to the options selected in the User Interface
    
    // CCP5M Setoutput; DC5B 0;
    CCP5CON = 0x08;
    
    // CCPR5L 0;
    CCPR5L = 0x00;
    
    // CCPR5H 0;
    CCPR5H = 0x00;
    
    // Selecting Timer 1
    CCPTMRS1bits.C5TSEL = 0x0;
}
#10
RISC
Super Member
  • Total Posts : 4737
  • Reward points : 0
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2017/07/17 14:07:05 (permalink)
+2 (2)
Hi,
RA4 function priorities are set as follows (see datasheet page 130 table 10-4) :
(highest priority)  SRQ > C1OUT > CCP5 > RA4
So it means SRQ, CMP1 and CCP5 must be disabled so that the pin is available as I/O
Did you set RA4 function (input or output) in the MCC pin manager grid by also making sure you select the package type. then generate the project.
By default (reset) I think SRQ, CMP1 and CCP5 are disabled. check the datasheet for each of this peripherals
Regards
#11
ShierSolutions
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2015/11/11 11:45:26
  • Location: 0
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2017/07/17 16:53:34 (permalink)
0
Thank you for the help! The problem is resolved!
 
I'm using RA4 as a data pin for a display. CCP5 is used with the ADC. Fortunately, we don't need to take measurements while writing to the display. So in the display function, I disable CCP5 then re-enable it at the end. That worked perfectly.

This problem plagued us for many months and we had to jumper our PCBs to work around it, so I'm very happy to have a solution.
#12
RISC
Super Member
  • Total Posts : 4737
  • Reward points : 0
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2017/07/18 00:25:58 (permalink)
0
Please put [solved] in your thread title
#13
Laslite
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2016/02/26 23:45:03
  • Location: 0
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2018/01/12 10:41:55 (permalink)
0
Hello,
I have the same big problem PORT RA4 OUTPUT of PIC18F46K22. The output only flashes, but there is no switching output.
I connect a LED with resitor directly to the RA4 port.
Can anybody help me with code snippets?

Thanks a lot
post edited by Laslite - 2018/01/12 10:43:27
#14
rodims
Super Member
  • Total Posts : 950
  • Reward points : 0
  • Joined: 2009/02/10 11:08:59
  • Location: 51.9627, 7.6262
  • Status: offline
Re:PORT RA4 OUTPUT of PIC18F26K22.... Strange behaviour... 2018/01/12 11:02:54 (permalink)
+2 (2)
I have the same big problem ...

If it really would be the same problem, this old thread would already solve your problem. 
 
If it does not, then please create your own thread and don't hijack it, which already has been done 1/2 a year before.
What do you want ? Code snippets, or debug your code ?
 
Please don't answer to my questions here, but create your own topic and add more information.
If you want do get help with your code, then add it to your post.  And please use the Forums "code tags" for readability.
post edited by rodims - 2018/01/12 11:05:36
#15
Jump to:
© 2018 APG vNext Commercial Version 4.5