PSOC 5LP: PCF 8563 configuring using 4x4 Matrix keypad

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Y_r
Level 4
Level 4
50 replies posted 50 sign-ins 25 replies posted

Hello, @MotooTanaka san,

The new I2C implementation to configure the PCF 8563 RTC works as expected.😃

Based on our previous topics, keypad_buffering and configuring_RTC, I modified the last sample firmware of storing the keypad input buffering.

The modification is that if the keypad input is 1, which is '1' (ASCII representation) is converted to represent hex 0x1 and then the same is written to the RTC (using Byte() API's) using Write_RTC() function.
And then the time and date info is read back in the same Write_RTC() function, using RTC_Read() function.

So, now the problem that I notice is at lines 271 and 272, when I am again trying to call RTC_Read() function, the program directly starts reading and printing some random data onto the Terminal (No input is taken) when any button on the keypad is pressed.

When the data is read back in the Write_RTC() function (commenting lines 271 and 272), everything is working fine. But, when uncommenting lines 271 and 272 (reading the RTC at some other time, after configuring), there is no response and i am not able to reach any conclusion as to what might be causing the issue.

In order for you to test this, try entering "48592331011209" (SS MM HH Day Weekday Month YY) using the keypad in the firmware (attached) as is (commented 271 & 272) and you can see that the date and time are read back properly.
Then try the same after commenting lines 271 & 272, the firmware is struck.

Hope you got what I wanted to ask your help about.

PS: I am a novice programmer, so bear with me a bit please.😅

Regards,
Yash

 

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

From where should I start ...

I think that it is a good time for you to re-think/re-design your application.

What you want let the buttons to do.

 

Your program was working as you wrote, when you put

RTC_Read() and break for letters '0' ~ 'C', 

pushing these button causes RTC_Read(),

which repeats read RTC and write for 20 times.

Then as you put break, the next lines of setting letter to the key_buf was not executed.

 

For a sample to start with,  I modified your code as below

(1) Originally RTC_Read() had following functions

(a) Repeat 20 times

(b) Read RTC value

(c) Write RTC value

(d) go to top_menu

I changed RTC_Read() do only (b) and (c) and let other function(s) to take care of (a) and (d)

 

(2) In do_str_test() you were storing all letters '0' ~ 'C'  for the RTC, we only need '0' ~ '9'

So I modified the switch statement as

'0' ~ '9' : store the letter to the key_buf[]

'A'~'C" : only echo the letter and do nothing

'*' : let this work as "Backspace"

'#' :  write key_buf[] to RTC regs

'd': display date and time each seconds for 20 times

Tera Term log

001-Tera-Term-log.JPG

Now uncommenting line 278 (RTC_Read()) works, too.

But I don't know if this is what you want...

002-Tera-Term-log2.JPG

Anyway, have fun writing and studying the coding 😉

moto

 

View solution in original post

2 Replies
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

From where should I start ...

I think that it is a good time for you to re-think/re-design your application.

What you want let the buttons to do.

 

Your program was working as you wrote, when you put

RTC_Read() and break for letters '0' ~ 'C', 

pushing these button causes RTC_Read(),

which repeats read RTC and write for 20 times.

Then as you put break, the next lines of setting letter to the key_buf was not executed.

 

For a sample to start with,  I modified your code as below

(1) Originally RTC_Read() had following functions

(a) Repeat 20 times

(b) Read RTC value

(c) Write RTC value

(d) go to top_menu

I changed RTC_Read() do only (b) and (c) and let other function(s) to take care of (a) and (d)

 

(2) In do_str_test() you were storing all letters '0' ~ 'C'  for the RTC, we only need '0' ~ '9'

So I modified the switch statement as

'0' ~ '9' : store the letter to the key_buf[]

'A'~'C" : only echo the letter and do nothing

'*' : let this work as "Backspace"

'#' :  write key_buf[] to RTC regs

'd': display date and time each seconds for 20 times

Tera Term log

001-Tera-Term-log.JPG

Now uncommenting line 278 (RTC_Read()) works, too.

But I don't know if this is what you want...

002-Tera-Term-log2.JPG

Anyway, have fun writing and studying the coding 😉

moto

 

Hello, @MotooTanaka san,

The above sample is what I intended to end up with, but did some silly mistakes 😅 as you pointed out.

"RTC_Read() and break for letters '0' ~ 'C',  pushing these button causes RTC_Read(), which repeats read RTC and write for 20 times.
Then as you put break, the next lines of setting letter to the key_buf was not executed."
=> I didn't realize this until you pointed out and I was like🤦‍ (noticed but didn't realize).

I can't thank you enough for the help and direction and explanation that you provide with.

Thanks and Regards,
Yash