Notifications
Clear all

Using a pin to signal another pin

68 Posts
7 Users
0 Likes
3,825 Views
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6974
Topic starter  

@dw I understand the setting of a bit flag in an ISR. What you said was there did not need to be a pin involved, that you could use a register. I know nothing about a register. Just show me the declare for that.

Not aggresive, I am an 81 yo autistic tube guy just trying to learn about solid state stuff. I see you posting on two old topics after you have been absent for 3 years. Your posts look like chatbot answers but I could be mistaken.

Since you are unable or unwilling to educate me further on how to set up a hardware interrupt without using a pin, I am forced to the conclusion that you perhaps misunderstood something.

The second topic you decided to comment on has some history, I suggest you read back through that topic so you can see what the real problem is. HINT, it involves OSHA.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
 dw
(@dw)
Member
Joined: 3 years ago
Posts: 15
 

Ron

What you said was there did not need to be a pin involved, that you could use a register

.

I think you misunderstood.

My understanding of the question - was about the need for TWO pins.

-quote

I am thinking of using AN OUTPUT PIN of one process to signal ANOTHER  process to do something via it's INPUT INPUT. 

.

My understanding of this question is that it entails two pins.

When I was asked about how one would association a BIT variable with a hardware interrupt (the use of one pin) that was what I explained

.

On your other comments - I have a high respect for Bill - who graciously provided this forum platform

I don't see aggressive unfriendly behavior as appropriate.

Enough Said!!


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6974
Topic starter  

@dw None of my behaviour has been that, if anything it's you. And that is not what you said.

Here is what you said, nothing to do with two pins.

The MCU has a special register dedicated to every IO pin

So when an interrupt is executed for the state of a pin - the MCU is not reading the pin - it is reading the state of that pin's register.

But one does not have to use an actual hardware pin with its associated register

One can simply use any register one wants to use as a register dedicated for the interrupt.

So one could declare a BIT variable to be used as a FLAG

A register will then be exclusively dedicated to store whatever the state of that BIT variable happens to be.

An interrupt can then be based on reading that register

In such case - an IO pin does not have to be involved in the process

I then asked

How do you associate a bit variable to a hardware register?

I know how to associate a bit variable to a PIN, I am still waiting for you to show me how to NOT have to use a pin as you stated.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

I know how to associate a bit variable to a PIN, I am still waiting for you to show me how to NOT have to use a pin as you stated.

If that isn't aggressive, I don't know what is.

I'm curious @dw, are you saying that you can simply flip a bit to trigger an interrupt?


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6974
Topic starter  

@yurkshirelad It's simply a question, how is that aggressive? @dw said there was a way to set up an interrupt that was a new way to me. Is it 'aggressive' to ask how?

The only way I know for a hardware interrupt is as follows

attachInterrupt(digitalPinToInterrupt(pin), ISR, mode) (recommended)

@dw said

But one does not have to use an actual hardware pin with its associated register

I am simply asking how to do that?

BTW, I did check the manual but did not see any other way to accomplish this.

 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

I'm not sure I fully understand what he means, but maybe you have to use the ESP32 API and setup an interrupt, and it doesn't need to be associated with an external pin. You may not need any pins at all.

As a side note, I wonder if when an interrupt occurs on a pin, the O/S sets a bit in a flag, which is used to identify the interrupt. Maybe you can manually flip his bit in the code and the O/S says "hey I got interrupted!".

I'm reading a bit about the interrupt mux in the ESP32 but it doesn't make any sense yet. Very interesting but also very confusing. I wish I were smarter!


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6974
Topic starter  

@yurkshirelad Not only is there MUX, there is ISR_RAM (I don't think that's the correct wording but it's close) there is also CRITICAL_SECTION which I never understood how it was different from setting noInterrupts();

In order for what he said to be valid, there has to be a substitute for attachinterrupt. I don't recall ever seeing that and I have been into the API as well as the hardware manuals.

When I started this topic, I was not thinking of a specific board. The UNO at least has NO software interrupt ability (unless you count timers which I do not) then you mentioned esp32 and that opens up an entirely different can of worms. The problem is we are still limited to the same functions as the UNO at least when using the ArduinoIDE. It may be different with the Espressif IDE and I did take a quick look but did not see any additional information re Interrupts.

I really hope @dw will take me at my word, I want to know how to do what he claims as every tool in my toolbox is precious.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
 dw
(@dw)
Member
Joined: 3 years ago
Posts: 15
 

@yurkshirelad 

Hi yurkshireland

That was not what I was thinking - but you do raise an interesting question!

On some micros there is what is called an INTCON0 register which contains status FLAGS for interrupt the various status of various interrupt processes

In the PIC days we used to use the POKE command to set a system register (not a variable register).

But I suspect a timer interrupt would more likely be used - where one would have a timer counting down - and when it reaches zero it triggers a service routine - in which it would be easy to set a BIT variable register for later use.   It would then reset the counter and continue to repeat that process.

Aren't micro-controllers fun!!  :-]


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6974
Topic starter  

@dw @yurkshireLad It looks like the esp32 has software interrupts, the Arduino does not. Here is a snippet of code that looks to be the implementation of a software ISR. The last instruction i will bet a coffee on is 'return from interrupt' before that looks a lot like restoring the environment, and my guess is this is high priority int 5. Sorry I don't read this assembly but I do read others and this looks to me to be how one would set up an ISR called xt_highint5 which may mean 'external high priority interrupt 5'.

In any case, I still do not see any way to utilize interrupts in C++ by other than a specific hardware pin or a timer.

It sounds like @dw was maybe thinking of a PIC scenario that is not applicable to Arduino but maybe esp but I don;t see how to implement it even if true.

Screenshot 2023 12 19 at 19.14.54

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

Posted by: @zander

@yurkshirelad Not only is there MUX, there is ISR_RAM (I don't think that's the correct wording but it's close) there is also CRITICAL_SECTION which I never understood how it was different from setting noInterrupts();

In order for what he said to be valid, there has to be a substitute for attachinterrupt. I don't recall ever seeing that and I have been into the API as well as the hardware manuals.

When I started this topic, I was not thinking of a specific board. The UNO at least has NO software interrupt ability (unless you count timers which I do not) then you mentioned esp32 and that opens up an entirely different can of worms. The problem is we are still limited to the same functions as the UNO at least when using the ArduinoIDE. It may be different with the Espressif IDE and I did take a quick look but did not see any additional information re Interrupts.

I really hope @dw will take me at my word, I want to know how to do what he claims as every tool in my toolbox is precious.

 

A critical section wraps a block of code, and ensures that it can't be interrupted by another process or thread, even when interrupts are enabled. It's different from noInterrupts(), which I assume simply disables all interrupts.

 


   
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

attachinterrupt is a wrapper function, designed to hide the low level implementation details on any platform. On the ESP32, it probably makes calls to the Espressif framework, including the low level ESP32 function esp_intr_alloc(). You may have to dive deeper into platform specific code and ignore the Arduino libraries. I wish I had more to offer, but sadly that's where my knowledge ends.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6974
Topic starter  

@yurkshirelad Of course, see I told you I was old and forgetful. So do I gather from that if an interrupt happens during a critical section that it will get serviced after the critical section, while noInterrupts(); means that any interrupts that happen are forgotten? That must be the case. Otherwise, there is no difference, I think.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

Posted by: @zander

@dw @yurkshireLad It looks like the esp32 has software interrupts, the Arduino does not. Here is a snippet of code that looks to be the implementation of a software ISR. The last instruction i will bet a coffee on is 'return from interrupt' before that looks a lot like restoring the environment, and my guess is this is high priority int 5. Sorry I don't read this assembly but I do read others and this looks to me to be how one would set up an ISR called xt_highint5 which may mean 'external high priority interrupt 5'.

In any case, I still do not see any way to utilize interrupts in C++ by other than a specific hardware pin or a timer.

It sounds like @dw was maybe thinking of a PIC scenario that is not applicable to Arduino but maybe esp but I don;t see how to implement it even if true.

-- attachment is not available --

 

You're right, this is an assembler implementation of an interrupt. I believe you can do the same thing in C, but you have to use a lower priority interrupt.

 


   
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

Posted by: @zander

@yurkshirelad Of course, see I told you I was old and forgetful. So do I gather from that if an interrupt happens during a critical section that it will get serviced after the critical section, while noInterrupts(); means that any interrupts that happen are forgotten? That must be the case. Otherwise, there is no difference, I think.

I'm not sure if the interrupt doesn't happen until the critical section is exited, or if the interrupt happens, but its handler is blocked from entering that critical section until the other thread or process has exited it. If that makes sense.

I think noInterrupts() means the interrupts don't occur at all. There may be exclusions to that statement, such as critical (highest priority) interrupts do still happen and perhaps only software, GPIO or low priority interrupts don't. But I don't know the platform specific details.

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6974
Topic starter  

@yurkshirelad No doubt there is a lot going on under the covers. I would not use the word 'libraries' however, that could mislead others trying to follow, if you look in the libraries section of the arduino IDE you will only see timer libraries installed if any at all. I think a more precise description is hardware mapping.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Page 4 / 5