Changing Controller from PIC 16f628A to 16f87 - Help Needed

  • Thread starter mishobg12
  • Start date
In summary, the speaker encountered an issue with using PORTB<0-3> for I/O on a new controller. They attempted to configure the pins for serial communication but were unsuccessful. After further testing and debugging, they realized that the issue was related to the state of the ports depending on what was read from the EEPROM and the location of certain registers in different banks. They express gratitude for the advice given by schip, but mention that they prefer using Microchip's free C compilers for their product line.
  • #1
mishobg12
25
0
I needed more EEPROM so I decided to change the controller. I don't seem to be able to use at lest PORTB<0-3> for I/O on the new controller. I understand they can be configured to be used for serial communication and I used the following instructions trying to make them I/O ports:
bcf T1CON, T1OSCEN
bcf T1CON, TMR1CS
bcf T1CON, TMR1ON

bcf SSPCON, SSPEN Sadly, no result. Help please
 
Engineering news on Phys.org
  • #2
In general I don't think you need to do anything special to use pins as "regular" Digital I/O. Just twiddle the TRIS bits as appropriate for In/Out and read/write the Port register or bits. It appears that your missing bits can be used for timer Capture and SPI I/O. The T1CON register you are diddling is for controlling a Timer, so you might be inadvertently mis-setting them. I would remove all of that and then go looking through your code to see if you have other examples of trying to use special I/O features where none are needed.

I'm not familiar with either of the PICs you are using offhand, but you might go look at the Microchip selection matrix and see if there is a different ROM upgrade path for the F628... Also I gave up on PICASM long ago because MicroChip has some pretty nice (free) C compilers for their product line -- just a personal preference.
 
  • #3
After testing and debugging all day yesterday I finally figured out what the problem was today. My ports work just fine, but their state depends of what is read from the EEPROM and obviously EEADR, EEDATA and EECON1 are in different banks. Phew, I should have guessed way earlier.
Thank you for your reply, though, schip.
 

1. What is the difference between PIC 16f628A and 16f87 controllers?

The PIC 16f628A and 16f87 are both microcontrollers produced by Microchip Technology. The main difference between the two is their architecture. The 16f628A uses the mid-range architecture while the 16f87 uses the enhanced mid-range architecture. This means that the 16f87 has more advanced features and capabilities, such as more memory and peripherals, compared to the 16f628A.

2. Can I directly replace my PIC 16f628A with a 16f87 controller?

No, you cannot directly replace the two controllers without making necessary changes. As mentioned, they have different architectures and thus have different instruction sets and pin configurations. You will need to modify your code and possibly your circuit design to accommodate the new controller.

3. Is there a specific program or software needed to change controllers?

Yes, you will need a programming software, such as MPLAB IDE, to change controllers. This software allows you to write and debug code for your microcontroller. You will also need a programming tool, such as a PICkit, to physically program the new controller.

4. Can I use the same code for both controllers?

While there may be some similarities in the code for both controllers, you will need to make changes to the code to account for the different instruction sets and peripherals. It is important to carefully review and modify your code before programming the new controller.

5. Are there any other considerations when changing controllers?

Aside from modifying your code, you may also need to adjust your circuit design to accommodate the new controller's pin configuration and power requirements. It is also important to carefully read the datasheets for both controllers to ensure compatibility and to understand any other differences that may affect your project.

Similar threads

  • Electrical Engineering
Replies
2
Views
2K
  • Electrical Engineering
Replies
2
Views
2K
  • Electrical Engineering
Replies
10
Views
3K
  • Programming and Computer Science
Replies
3
Views
1K
Replies
14
Views
3K
  • Electrical Engineering
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Electrical Engineering
Replies
1
Views
2K
  • Programming and Computer Science
Replies
4
Views
2K
  • Electrical Engineering
Replies
14
Views
3K
Back
Top