tago

Please help me to understand how the NG app works internally

29 posts in this topic

In your code you had assigned SR1 to both the keyboard and the DIO (J5A) module. This is invalid. You have to use a SR number that it not in use.

And the last pin on the 8th SR is Pin 64 (8x8). So the first pin on the 9th is 65. 

Edited by FantomXR

Share this post


Link to post
Share on other sites

Thank you very much @FantomXR

Are 8 SRs in use because the DIO module is configured as a matrix for keyboard scanning?

I don't properly understand what these parameters mean:

KEYBOARD n=1 rows=8  dout_sr1=1  dout_sr2=2  din_sr1=1  din_sr2=2

Looks like there are 4 SRs (2 in / 2 out) in use or is it only two? What does dout_sr1=1 mean? Is 1 an unique identifier?

Share this post


Link to post
Share on other sites
43 minutes ago, tago said:

Are 8 SRs in use because the DIO module is configured as a matrix for keyboard scanning?

I don't see the reason why TK choosed sr=9 as emulated shiftregister. But anyway: When working with emulated elements (same is valid for button- & LED-matrices f.e.) it's always good to use a value that is definitely not blocked by real hardware.

The keyboard blocks the first two digital input-SRs (usually HC165) and the first two digital output-SRs (usually HC595). 

dout_sr1=1 means the first HC595 in the digital chain. din_sr1=1 means the first HC165 in the chain. For a beginner this might be confusing. 

In NG you can set the total number of scanned shiftregisters with this command:

SRIO num_sr=2

Even though in this example I set num_sr=2 I can connect in total 4 shift registers. 2x HC165 and 2x HC595.

Edited by FantomXR

Share this post


Link to post
Share on other sites

As mentioned by Christian, there was no special reason why assigned DIN and DOUT SR #9 to the DIO function.

I thought this might be better in case you would like to add more physical SRs in future, no need to change the IDs again until you reach #9. If you don't like this, you could also use SR #3, but not SR #1 or SR #2, because these positions are already allocated by the scan matrix.

Btw.: the most simple way to find out the hw_ids is to enter "set debug on" in the MIOS terminal, then trigger the buttons and observe the debug messages in the terminal (doesn't work with LEDs of course, but if you know the button position, you can easily conclude on the LED position)

Best Regards, Thorsten. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now