Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

PIC 16f628A to 16f87

  1. Jul 20, 2010 #1
    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


    Sadly, no result. Help please
  2. jcsd
  3. Jul 20, 2010 #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.
  4. Jul 22, 2010 #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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook