PIC 18F4455 simple project help

Feb 03, 2008 8 Replies

hi, i've started playing with 18F4455 device. im using MPLAB with c18 compiler student version. as a start what am trying to do is to light an LED connected to pin 6 (RA4). here is the code.



#include #pragma config WDT = OFF



void main() { ADCON1 = 0x0F; CMCON = 0x07; TRISA = 0xCF; LATAbits.LATA4 = 1; while(1); }



how ever the LED in the target circuit does not light !. please let me know whether there is any problem with the above code. ( how ever i am able to debug it using ICE 2 without any problem) my device is 18F4455.



thanks


Did you build the board yourself or did you buy it from somewhere ??

How is the LED wired, LATAbits.LATA4 = 1; means the pin will go HIGH to

3 volts. Is the LED wired with the anode of the LED connected to pin 6 with a resistor in series of the PIC and the cathode connected to ground ??

Thanks for sharing.

donald

thanks for the reply.. Im sure about the hardware side because i have done lot of projects in the past with PIC's (sorry i forgot to mention that). but i almost forgot firmware side of it, so im not sure whether the above code is complete. specifically not sure whether i've missed out any configuration, etc. (the oscillator config is set using the IDE - not in the source).

im getting this error when i try to set the oscilator config from code..

Error [1224] configuration setting 'OSC' not recognized

my device is 18f4455. any idea?

im getting this error when i try to set the oscilator config from code..

Error [1224] configuration setting 'OSC' not recognized

my device is 18f4455. any idea?

Check your data sheet, on most 18fxxxx devices pin A4 is open drain. It won't source current.

Paul Probert

Most 18F devices released in the last several years (including the

18F4455) do not have an open drain on RA4.
John W. Temples, III

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required