CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Broken Output port Pin?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hello188



Joined: 02 Jun 2010
Posts: 74

View user's profile Send private message

Broken Output port Pin?
PostPosted: Tue Apr 26, 2011 8:08 pm     Reply with quote

Hi, currently, I am working with PIC18Fk46k22, and checking the output functionality.

To PORTD0~PORTD.5, a solenoid relay is connected via opto-coupler with separate ground, so the MCU is electrically isolated from the back EMF from inductor.

To check, I simply set port direction to outputs and output 0x00 to the PORTD, to turn on the LED and solenoid.

I am working with two identically constructed target board, and looking at PORTD register with ICD3 debugger.

The strange thing I discovered is that depending on the target board, WITH SAME PROGRAM, certain bits(higher bits, which are 7, 6, 5,4) can not stay 0, and instead gets pulled back up to 1.

Below is my code

Code:

//SETUP
#INCLUDE<18F46K22.h>
#INCLUDE<def_18f46K22.h>
#FUSES HSH, NOPLLEN, NOIESO, PUT, NOBROWNOUT, NOWDT, NOPBADEN, MCLR, STVREN
void main(void){
TRISD  = 0x00;
PORTD = 0x00
while(1);
}


As I look at the registers on the WATCH window, TRISD remains 0x00 but PORTD reads 0b00010000 or 0b00110000 depending on the target board.

I am thinking the two pins(PORTD.5, and PORTD.6) got somehow damaged? I think that the condition is affecting the SFRs too since ICD3 is reading from them.

Anyone has experienced this??

Thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 26, 2011 8:40 pm     Reply with quote

Post your compiler version.
hello188



Joined: 02 Jun 2010
Posts: 74

View user's profile Send private message

PostPosted: Tue Apr 26, 2011 9:51 pm     Reply with quote

It's 4.120 The latest

When I run it with simulator instead of ICD3, the port behaves fine.

Thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 26, 2011 10:35 pm     Reply with quote

What do you see if you look at the pins with an oscilloscope ?

Also, describe your oscillator circuit.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Apr 27, 2011 12:39 am     Reply with quote

What's the IO load current? Source or sink?
hello188



Joined: 02 Jun 2010
Posts: 74

View user's profile Send private message

PostPosted: Wed Apr 27, 2011 5:19 pm     Reply with quote

On the oscilloscope, the voltage is Vcc.

The sink currents should be less than 10 mAs
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group