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

  • Thread starter Thread starter mishobg12
  • Start date Start date
AI Thread Summary
The user switched from a PIC 16F628A to a PIC 16F87 for increased EEPROM but encountered issues using PORTB<0-3> for I/O. Initial attempts to configure these pins involved manipulating the T1CON and SSPCON registers, but no success was achieved. It was suggested that the user should focus on adjusting the TRIS bits for proper I/O functionality and avoid unnecessary configurations related to timers and SPI. Ultimately, the user discovered that the issue stemmed from the state of the ports being dependent on EEPROM reads, with relevant registers located in different banks. The problem was resolved, confirming that the ports functioned correctly once the EEPROM interaction was understood.
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.
 
Very basic question. Consider a 3-terminal device with terminals say A,B,C. Kirchhoff Current Law (KCL) and Kirchhoff Voltage Law (KVL) establish two relationships between the 3 currents entering the terminals and the 3 terminal's voltage pairs respectively. So we have 2 equations in 6 unknowns. To proceed further we need two more (independent) equations in order to solve the circuit the 3-terminal device is connected to (basically one treats such a device as an unbalanced two-port...
suppose you have two capacitors with a 0.1 Farad value and 12 VDC rating. label these as A and B. label the terminals of each as 1 and 2. you also have a voltmeter with a 40 volt linear range for DC. you also have a 9 volt DC power supply fed by mains. you charge each capacitor to 9 volts with terminal 1 being - (negative) and terminal 2 being + (positive). you connect the voltmeter to terminal A2 and to terminal B1. does it read any voltage? can - of one capacitor discharge + of the...
Thread 'Weird near-field phenomenon I get in my EM simulation'
I recently made a basic simulation of wire antennas and I am not sure if the near field in my simulation is modeled correctly. One of the things that worry me is the fact that sometimes I see in my simulation "movements" in the near field that seems to be faster than the speed of wave propagation I defined (the speed of light in the simulation). Specifically I see "nodes" of low amplitude in the E field that are quickly "emitted" from the antenna and then slow down as they approach the far...

Similar threads

Replies
2
Views
2K
Replies
2
Views
2K
Replies
3
Views
2K
Replies
7
Views
180
Replies
3
Views
3K
Replies
1
Views
2K
Back
Top