Hello guys,i am new so, can anyone tell me where i have wrong?.I have a keyboard (PS2) connected to an 16f877a and nokia 3310 display.This circuit is working, when i type a letter is displayed on the display.The problem is when i change the microcontroller to 18f4550, it doesn't happend anything.
To make the code more simple i made some changes.

Now the code is a little bit smaller ...
My bit configuration for pic16f877a is 2F4A (i have no ideea what that means)
For 18f2520 is 0700 1f1f 8300 0085 C00F E00F 400F ( no ideea either )

I use picKit 2 software v2.61

Not all bits can be changed , only few. What should be the new configuration?...

Click to expand...

Compare your configuration bits and their meanings for the 16F877A from page 146 here, to the configuration bits for the 18F2520 on page 251 here, you'll notice there are many more configuration words in the 18F2520...

The new MPLABX is much better, you can change the configuration bits in the IDE, there is a textual explanation for each line.

Then you have a button to generate code to copy&paste it into a specially designed file: configuration_bits.c

If your code still does not work then it is not watertight for use on different controllers, you have to take it apart, and put it back together step by step, adding means of testing if each step is doing what it should.

I didn't understood much thing from those pages.
And i didn't manage to change configuration bits from picKit2 software. When i'm loading the hex the bits are changing back.

Doh.....it's frustrating.

Click to expand...

Those pages describe the way the microcontroller will operate. They control everything from the clock source to the watchdog timer to code-protection. I would suggest becoming familiar with those terms and reading through the Configuration Bits section in the datasheet. From there, you should be able to understand what each bit in the configuration word(s) does.

Something that may be breaking your program is that in the PIC16 series, outputs are changed by writing to the Ports directly. On the PIC18 series, you need to write the new outputs into the Latches (LATA, LATB, etc), rather than Port.

Something that may be breaking your program is that in the PIC16 series, outputs are changed by writing to the Ports directly. On the PIC18 series, you need to write the new outputs into the Latches (LATA, LATB, etc), rather than Port.

Click to expand...

I remember always writing to the PORT register when starting with the 18F. Found this from the datasheet:

Reading the PORTA register reads the status of the
pins, whereas writing to it, will write to the port latch.

I'd suggest trying to read the datasheet and understanding a bit of it, I know they are long and about as fun ot read as a.. datasheet. However, Microchip Data Sheets cover every aspect of the controller, so they tend to be long, but also answer every question.

If you look at the pinned "Resources for PIC Programmers" which I believe is in the Embedded Systems subforum here, you'll find a link that is an "app note" for migrating designs from mid-range PICs to the PIC18 series, in addition to the latches and config word, some other things changed as well.

The more you work with it, the more sense the datasheet will make, and vice-versa. The datasheet is a lifesaver, especially when you plan to use a hardware peripheral, such as the MMC, or USB onboard.