I have a design using the s9s12g64f0mlh. My design has front panel encoders for user input. They are simple mechanical encoders with 16 pulses/revolution. I’ve attached the Phase-A, & Phase-B signals to PAD8 (pin #34), and PAD9(pin#36). There is a pull-up, and series resistor with small cap to keep the switching noise in check. I can’t seem to read the digital state of the pin at all. Looking on both PT0AD (0x270), and PTI0AD (0x272) I get 1’s. I can change the data direction and write a state high or low. The pin drives correctly (as seen on a scope), and reports the correct status on both PT0AD (0x270), and PTI0AD (0x272). Strangely the upper nibble bits (PAD12-15) work fine as outputs, or inputs.
I have these setup bytes:
DDR0AD = 0x40
PER0AD = 0x14
I have tried playing with ACMPC (0x0260), but it doesn’t seem to be the problem.
Has anyone else seen this happen? I’ve been designing hc12’s and writing software for years, and I’ve not had a problem like this before.
Hi
Port AD pins have digital input buffers disabled by default. Look for ATDDIEN in datasheet.
Edward
Edward,
Thank you for your reply. Your answer helped quite a bit. I still had to change ACMPC(0x0260) = 0x40 to enable inputs for PAD10, and PAD11. It looks like all the digital inputs are working!
correction:
ACMPC(0x0260) = 0x10
This will enable the inputs for PAD10, and PAD11