KeyPad 4X4 Error

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

KeyPad 4X4 Error

Post 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.
Attachments
Flowcode2.fcfx
(13.73 KiB) Downloaded 253 times
Last edited by seokgi on Wed Aug 17, 2016 11:30 am, edited 1 time in total.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: KeyPad 4X4 Error

Post by Benj »

Hello,

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

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: KeyPad 4X4 Error

Post by seokgi »

Benj!!!

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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: KeyPad 4X4 Error

Post 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.matrixtsl.com/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).

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: KeyPad 4X4 Error

Post by seokgi »

Thanks Benj!!

Also Port B is same state.

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: KeyPad 4X4 Error

Post by seokgi »

How about this Program. Use port B
Attachments
Flowcode2.fcfx
(12.74 KiB) Downloaded 253 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: KeyPad 4X4 Error

Post 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?

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: KeyPad 4X4 Error

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: KeyPad 4X4 Error

Post 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.

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: KeyPad 4X4 Error

Post by seokgi »

B6,B7 is Puls signal out. B4,B5 is no signal

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: KeyPad 4X4 Error

Post 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 7129 times
Signals2.jpg
Signals2.jpg (93.99 KiB) Viewed 7129 times
Here is the current project with the PLL disabled.
Flowcode3.fcfx
(12.76 KiB) Downloaded 255 times

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Has thanked: 18 times
Been thanked: 16 times
Contact:

Re: KeyPad 4X4 Error

Post 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!!!

Post Reply