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

  • Thread starter Thread starter mishobg12
  • Start date Start date
Click For Summary
SUMMARY

The discussion centers on transitioning from the PIC 16F628A to the PIC 16F87 microcontroller due to the need for additional EEPROM. The user encountered issues with configuring PORTB<0-3> for I/O, mistakenly modifying the T1CON and SSPCON registers, which are intended for timer and serial communication functionalities. The resolution involved recognizing that the state of the ports is influenced by EEPROM values, specifically the registers EEADR, EEDATA, and EECON1, which reside in different memory banks. The user successfully restored functionality after addressing these issues.

PREREQUISITES
  • Understanding of PIC microcontroller architecture, specifically the PIC 16F628A and PIC 16F87.
  • Familiarity with EEPROM memory management in microcontrollers.
  • Knowledge of register manipulation, particularly T1CON and SSPCON.
  • Experience with assembly language programming for PIC microcontrollers.
NEXT STEPS
  • Research the Microchip selection matrix for potential ROM upgrade paths for the PIC 16F628A.
  • Learn about EEPROM handling in PIC microcontrollers, focusing on EEADR, EEDATA, and EECON1 registers.
  • Explore alternatives to PICASM, such as Microchip's free C compilers for PIC programming.
  • Investigate best practices for configuring I/O ports on PIC microcontrollers to avoid similar issues.
USEFUL FOR

This discussion is beneficial for embedded systems developers, engineers transitioning between PIC microcontroller models, and anyone involved in EEPROM management and I/O configuration in microcontroller applications.

mishobg12
Messages
25
Reaction score
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
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.
 
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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
14
Views
5K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
3K