Helpful Reply18F46K22: TRISC Issue

Author
spitsnsparkin
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2013/01/21 07:59:32
  • Location: 0
  • Status: offline
2013/10/29 08:56:16 (permalink)
0

18F46K22: TRISC Issue

Hi to all,
 
Using the ICD2, after reset, the TRISC register is b'00011111' and not '11111111'.
 
I try to set it to b'11111111' through the IDE, but after the next step, it is back to b'00011111'
 
Does anyone have an idea?
 
Thanks in advance...
#1
miqueltrenchs
New Member
  • Total Posts : 24
  • Reward points : 0
  • Joined: 2010/09/28 03:37:25
  • Location: barcelona
  • Status: offline
Re:18F46K22: TRISC Issue 2013/10/29 09:09:31 (permalink)
0
Hi
 
Ports with mixed Analog and digital functionality must have ANSELx programmed as analog (default after reset,, all "1"s) or digital,, have to be reprogrammed to "0" lines used as digital.
 
Hope this help
 
Regards
 
Miquel Trenchs
#2
spitsnsparkin
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2013/01/21 07:59:32
  • Location: 0
  • Status: offline
Re:18F46K22: TRISC Issue 2013/10/29 09:53:33 (permalink)
0
Hi Miquel,
 
Thanks for your reply.  However, you have stated my problem exactly.
 
After a hardware reset (by the IDE reset button), TRISC does not reset to b'11111111' as expected.  ANSELC does reset to b'11111100' as expected.
 
Within the IDE watch window, I can re-write the TRISC to b'11111111' (and apparently it takes effect).  However, when I step to the next instruction, TRISC returns back to b'0001111'.  I cannot change the three MSBs of TRISC, they are stuck as zeros.
#3
Paul Wolstenholme
Super Member
  • Total Posts : 54
  • Reward points : 0
  • Joined: 2013/05/09 15:50:26
  • Location: New Zealand
  • Status: offline
Re:18F46K22: TRISC Issue 2013/10/29 12:54:19 (permalink)
+2 (1)
Hi,
 
I presume you are aware that the ICD2 gnerates a VPP voltage that exceeds the ratings of the K22 series.  The required adaptor is detailed in various places, although not the datasheet you will have referred to.
#4
spitsnsparkin
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2013/01/21 07:59:32
  • Location: 0
  • Status: offline
Re:18F46K22: TRISC Issue 2013/10/29 18:39:05 (permalink)
0
Hi Paul,
 
Thanks for your input.  I have already installed a voltage clamp on the MCLR line to limit the voltage.  I have had no problems with the programming and debug interface (run, stop, single-step, step-over, etc.).
 
As stated before, I can change the value of other SFRs in the watch window.  However, the 3 MSBs of the TRISC are frozen or stuck with the values of zero.
 
It might be just a glitch with the IDE and ICD2 reporting.  The actual value of TRISC may be correct, just reported incorectly.  I'll test this issue when the serial interface of the application is coded (which will use RC7 and RC6).
#5
Paul Wolstenholme
Super Member
  • Total Posts : 54
  • Reward points : 0
  • Joined: 2013/05/09 15:50:26
  • Location: New Zealand
  • Status: offline
Re:18F46K22: TRISC Issue 2013/10/29 20:37:35 (permalink) ☄ Helpful
0
I have 18F26K22 + ICD3 + MPLAB 8.92 and see TRISC behaving as it should in the watch window (0b11111111 after reset with manual changes to bits preserved throughout single-stepping.)
#6
spitsnsparkin
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2013/01/21 07:59:32
  • Location: 0
  • Status: offline
Re:18F46K22: TRISC Issue 2013/10/29 22:56:01 (permalink)
0
Hi Paul,
 
Thanks for setting up and testing the 18F26K22.  The fact that you did not observe the same results immediately after resetting the MCU confirms my suspicion that my issue is with the combination of parts I'm using: PIC46K22 + ICD2 + MPLAB 8.65.
 
I upgrade my IDE when I have to.  I hate the time wasted in learning the new process/functionality of the new IDE just to do the same thing I did in the previous IDE.  However, this might be the reason to update to a newer IDE.
 
I'm not looking forward to MPLAB X.  I have read that it expects the user to write only in a high-level language and not assembly.  I would prefer to use the latest version of MPLAB that supports the 18F and 24F code written in assembly.
 
Thanks again for setting up an MCU.
Best regards,
spitsnsparkin
 
#7
vloki
always on da run
  • Total Posts : 6650
  • Reward points : 0
  • Joined: 2007/10/15 00:51:49
  • Location: Germany
  • Status: offline
Re:18F46K22: TRISC Issue 2013/10/30 01:23:32 (permalink)
0
spitsnsparkin
I'm not looking forward to MPLAB X.  I have read that it expects the user to write only in a high-level language and not assembly.  I would prefer to use the latest version of MPLAB that supports the 18F and 24F code written in assembly.
Of course it will let you write code in assembly Smile
post edited by vloki - 2013/10/30 03:46:59

Posting images, links and code - workaround for restrictions.
#8
Jump to:
© 2017 APG vNext Commercial Version 4.5