Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Code for outputting data on PIC18F4431 ports doesn work!

Status
Not open for further replies.

carlair

Junior Member level 3
Joined
Jun 7, 2002
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Quebec
Activity points
170
pic18f4431

hi, i'm beginning to use the PIC18F4431 (i have used PIC18F458 before) and I don't succed even to make work this pic!!!

I have a simple code that simply outputs data on the ports, and absolutely nothing is output on the pic???

What could be my problem??

I think my Configs are goods,and i'm working at 24 MHz ....

thank you for your reply!!

luigi
 

Re: PIC18F4431 problem ....

Are you using assembler or C (which one)?

What is your oscillator and fuse configuration?

Can you post your code so we can take a look at it?

best regards
 

Re: PIC18F4431 problem ....

What is your oscillator config ?
 

PIC18F4431 problem ....

Wait a minute. Can you tell us the full part number of the PIC you're using?
 

Re: PIC18F4431 problem ....

hi, here is my code with the configs...

I am using C18 code and my configs are set as High speed chrystal, but I have tried with the internal oscillator, and it doesn't work anyway!!

my full part number is the following: PIC18F4431-I/P


Code:
#include <p18f4431.h>



#pragma romdata CONFIG
_CONFIG_DECL(											\
	_OSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H,						\
  	_PWRTEN_ON_2L & _BOREN_OFF_2L,								\
  	_WDTEN_OFF_2H  & _WINEN_OFF_2H ,							\
	_PWMPIN_OFF_3L & _LPOL_HIGH_3L & _HPOL_HIGH_3L & _LPOL_HIGH_3L, 			\
	_FLTAMX_RC1_3H & _PWM4MX_RB5_3H & _EXCLKMX_RC3_3H & _SSPMX_RC7_3H & _MCLRE_ON_3H, 	\
	_STVREN_OFF_4L & _LVP_OFF_4L & _BKBUG_OFF_4L,  						\
	_CONFIG5L_DEFAULT,  									\
	_CONFIG5H_DEFAULT,  									\
	_CONFIG6L_DEFAULT,  									\
	_CONFIG6H_DEFAULT,									\
	_CONFIG7L_DEFAULT,									\
	_CONFIG7H_DEFAULT	);
#pragma romdata


void Initialisation(void);


void main(void)
{

	Initialisation();

	while(1)
	{
		
		PORTB ++;
		PORTC ++;
		PORTD ++;
	}

}



void Initialisation(void)

{
////////////////////////////Init I/O PORTS////////////////////////
	PORTA = 	0b00000000 ;
	PORTB = 	0b00000000 ;
	PORTC = 	0b00000000 ;
	PORTD = 	0b00000000 ;
	PORTE = 	0b00000000 ;


	TRISA  = 	0b11111111 ;
	TRISB  = 	0b00000000 ;
	TRISC  = 	0b00000000 ;
	TRISD  = 	0b00000000 ;
	TRISE  = 	0b00000111 ;


///////////////////////////Init Interrupt enable//////////////////////
 	RCONbits.IPEN = 1;
   	INTCONbits.GIEL = 0;
   	INTCONbits.GIEH = 0;

}
 

PIC18F4431 problem ....

I don't have the datasheet in hand... but I'm wondering if you have overclock your PIC...
 

Re: PIC18F4431 problem ....

This may not be relevant but I had issues with 4x PIC18F4320 that required decoupling capacitors VDD to GND during programming or it did not program correctly.
PIC18F452's programmed fine without this so it was not the programmer.
 

Re: PIC18F4431 problem ....

Colbhaidh said:
PIC18F452's programmed fine without this so it was not the programmer.

Even it programmed fine, it's always recommended to connect a capacitor to Vdd & GND.
 

by the way,

I am using the Picall programmer latest version ( www.picallw.com ) and I have modified the device.ini fill, so it can accept PIC18F4431, but all of this works fine, because, when I read the device, my code is all ok ....


anyone has an idea of what I am doing wrong??
 

Re: PIC18F4431 problem ....

hill said:
I don't have the datasheet in hand... but I'm wondering if you have overclock your PIC...

Please ignore my comment for this.
Just checked that for the device you're using, using HS allow range from 4MHz to 25MHz.
 

Re: PIC18F4431 problem ....

Just checked that for the device you're using, using HS allow range from 4MHz to 25MHz.


I have tried with the internal oscillator, wich is 8MHz, and it doesn't seem to make a difference ...
 

PIC18F4431 problem ....

Could you post a schematic?
 

Re: PIC18F4431 problem ....

Could you post a schematic?


My schematic is a very simple one .... Power, reset pin set to Vcc and the 24 MHz crystal with the 22pF caps ...
 

Re: PIC18F4431 problem ....

Do you have a few PICs to try the same code?
 

Re: PIC18F4431 problem ....

thank you guys, it's now working fine....

I haved tried to put some caps closely to my device and reprogram it, and now it seem to work perfectly!!! 8O

regards ...
:eek:
Luigi
 

PIC18F4431 problem ....

Glad to hear that.

So remember: Even it programmed fine, it's always recommended to connect a capacitor to Vdd & GND, and keep the capacitor as close as possible to your device.
 

PIC18F4431 problem ....

one time it happened to me, it was the crystal which was blownout
 

Re: PIC18F4431 problem ....

Hi, I have the same problem. I have connected a 0,1 microF cap between Vdd and ground in my test board and can't still get it to start up at all. Have I misunderstood how the cap should be connected?

Have made a very basic curcuit and program that (should) turn on a LED (the first test PIC project for me since school, 10 years ago..).
The programming and verification works fine (with PICstart Plus and MPLAB IDE). I'm setting the config bits through code (assembly) with table reads and writes, and I think I have got it right.. have tried to set them with the table in MPLAB IDE too, didn't work either.. have tried with both internal osc and ext RC osc, neither works.
nothing seems to make it start, have tried with 2 different 18F4431 PICS:s. Starting to loose hope.. Could I have burned both the PIC:s trying?..

regards, OT
 

Re: PIC18F4431 problem ....

Hi again,
I found that a capacitor should also be connected between AVdd and AVss too. Tried that as well.. with both int and ext RC osc.. with setting the config bits with code and the MPLAB IDE table.. still no reaction at all from either of my PICs..
Would really appreciate if someone could advice me on this problem, so I can get started with my projects..

Regards, OT
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top