Page 1 of 1

KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 10:16 am
by seokgi
Using keypad 4x4.
But Column 1, 2 signal is out. 3, 4 signal is nothing.

Sorry! english little.

I have Ghost & FC7 PIC.

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 11:20 am
by Benj
Hello,

Please could you attach your program that is demonstrating the bug.

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 11:35 am
by seokgi
Benj!!!

Thank you for your interest. This is not the people who use fc7. it's too hard.

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 2:50 pm
by Benj
Hello,

Right your using pins A6 and A7 for those bits on the keypad.

In the device configuration settings (Build -> Project Options -> Configure Tab) your Oscillator is set to HS crystal oscillator which also uses pins A6 and A7.

If you need to use A6 and A7 then you will need to switch the oscillator type to INTOSC.

The INTOSC helper component available from the Tools -> Matrix Tools component menu will help you to configure the internal oscillator.
http://www.flowcode.co.uk/wikiv7/index.p ... 38a5735b6e

If your using an EB006 then there is a jumper (J18/J19) which configures if A6 and A7 are connected to the on-board crystal (OSC) or the PortA I/O D-Type connector (A6&7).

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 3:09 pm
by seokgi
Thanks Benj!!

Also Port B is same state.

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 3:30 pm
by seokgi
How about this Program. Use port B

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 4:30 pm
by Benj
Hello,

The second program looks like it should work fine.

Are you saying that pins B6 and B7 are also not doing anything?

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 4:50 pm
by seokgi
The second program is column 1 and 2 signal out. but 3,4 are no signal. i checked logic probe.

1,2 is pulse out 3,4 no signal.

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 5:05 pm
by Benj
Hmm,

The C code all looks ok to me, specifically the "MX_UINT8 FCD_08c31_keypad_base1__GetIndex()" macro which is responsible for scanning the keypad.

Code: Select all

while (FCL_INDEX < 4)
{
        switch (FCL_INDEX)
        {
            case 0:
            {
                #if (1) // 4 >= 1
                    FCP_SET(B, B, 0x10, 0x4, 1);
                // #else
                //Code has been optimised out by the pre-processor
                #endif
                break;
            }
            case 1:
            {
                #if (1) // 4 >= 2
                    FCP_SET(B, B, 0x20, 0x5, 1);
                // #else
                //Code has been optimised out by the pre-processor
                #endif
                break;
            }
            case 2:
            {
                #if (1) // 4 >= 3
                    FCP_SET(B, B, 0x40, 0x6, 1);
                // #else
                //Code has been optimised out by the pre-processor
                #endif
                break;
            }
            case 3:
            {
                #if (1) // 4 >= 4
                    FCP_SET(B, B, 0x80, 0x7, 1);
                // #else
                //Code has been optimised out by the pre-processor
                #endif
                break;
            }
            default:
            {
            }
        }
I'm going to compile and put the code on a micro and double check that all the column pins are firing.

Your not using ICD are you, the default ICD pins on the 16F1937 are B6 and B7? Also are you programming via a PICkit or other programmer that could be interfering, B6 and B7 are the chips programming pins.

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 5:11 pm
by seokgi
B6,B7 is Puls signal out. B4,B5 is no signal

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 5:11 pm
by Benj
Right the program wasn't running correctly for me because the PLL enable bit was set in the chips configuration.

I'm using a 19.6608MHz crystal on my hardware so the 4X PLL was multiplying the frequency too high to operate the device correctly.

Once I made this change I am getting spikes on all four column pins.
Signals.jpg
Signals.jpg (119.48 KiB) Viewed 8352 times
Signals2.jpg
Signals2.jpg (93.99 KiB) Viewed 8352 times
Here is the current project with the PLL disabled.
Flowcode3.fcfx
(12.76 KiB) Downloaded 337 times

Re: KeyPad 4X4 Error

Posted: Wed Aug 17, 2016 5:29 pm
by seokgi
I solved.

Using column b0,b1,b2,b3
row c0,c1,c2,c3

That's OK!

But I still don't know. Why does not the Port B.


Thanks So Much !!! Benj!!!