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

  • Thread starter Thread starter mishobg12
  • Start date Start date
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
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.