'Port C is going nuts!'
I have a project that is behaving very peculiarly. I am using a '73 for
a tachometer project. I am linking the tach into the CCP1 on the RC2
pin. I am running the TIMER1 and CCP1 ( in capture) peripherals.
As a general practice, In my main loop I normally re-write the TRIS
registers with the original settings. I do this because I read the app
note that indicates that port settings can be 'forgotten' when a stray
cosmic ray comes through.
I setup a pin on C as the result of a greater than comparison on the
RPM's. I was getting spurious false states on the pin. So I commented
the port set and reset lines. With no reads or writes to the pin, it
still had random square waves on it.
So I thought, 'That 12V on the emulator DID hurt it the other day, you
dummy'. So I burnt a windowed, and it did the same thing. Shaa.
Through trial and error, I determined that the act of updating the TRIS
registers was causing the port C pins to get random false states. Yes,
I am positive that the bank is being set right. The clincher is that if
the input waveform is stopped, causing the CCP1 to just whirl around
without latching, the false states go away.
In summary, the re-writing of the TRIS registers repeatedly while using
the TIMER1 and CCP1 together causes grossly wrong port states to be
written to the pins.
Now, I have been known to be totally wrong from time to time, so I am
reserving the right to show me my stupidity for my fellow piclisters.
Pioneer Microsystems, Inc.
PS.. backup plan is to look at the TRIS and re-write it only if it gets
hosed. Even then, it may false state once at that point. One of the
outputs will be linked directly to an open collector across the coil
line, which will cause a stutter. It is normally used to choke off the
engine on high RPM.
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- New search...