| View previous topic :: View next topic |
| Author |
Message |
ok1hdu
Joined: 10 Sep 2018 Posts: 47

|
Posted: Tue Jan 13, 2026 5:04 pm Post subject: AtXtiny TCA0 Event_Action (just for info) |
|
|
If I want to count input pulses with the TCA0 counter, I write:
| Code: | Config Event_system = Dummy , Ch2 = PC1 , Evsys_usertca0cnta = Ch2
Config Tca0 = Normal , Ovf_int = Enabled , Event_action = Count_pos_edge |
But then Code Explorer marks Event_Action as "Undeclared identifier"
and Count_pos_edge as "Invalid config parameter".
Also, when writing Config TCA0, then Ctrl+Space does not offer this option.
My solution:
If I want Code explorer without errors, I have to omit this parameter
and write separate seting:
| Code: | TCA0_EVCTRL = &B_0000_0001 'replaces: Event_action = Count_pos_edge |
Jarda |
|
| Back to top |
|
 |
albertsm
Joined: 09 Apr 2004 Posts: 6321 Location: Holland

|
Posted: Tue Jan 13, 2026 8:56 pm Post subject: |
|
|
I do not know the processor you use? So i tried some updi processor and indeed the option is not recognized while it is present in the DAT file.
So it seems this is a bug in the explorer. I will check it later and update this topic. _________________ Mark |
|
| Back to top |
|
 |
EDC
Joined: 26 Mar 2014 Posts: 1182

|
Posted: Tue Jan 13, 2026 9:02 pm Post subject: |
|
|
I also like the Code Explorer warnings because they work "on the go" and prevent to make long term mistakes on the code.
Another theme is that I sometimes wrote that "Baud3 for Mega2560" is "undeclared", the same way
"__readrampz" used by NETZMAN is undeclared too, same "Spi1move". Im patient and wait when Mark add this into the Code Explorer syntax  |
|
| Back to top |
|
 |
ok1hdu
Joined: 10 Sep 2018 Posts: 47

|
Posted: Tue Jan 13, 2026 9:41 pm Post subject: |
|
|
To Mark
I tested it with Attiny412 and Attiny3226.
I think that the same is also with AVR128DB48, but Im not sure.
Jarda |
|
| Back to top |
|
 |
albertsm
Joined: 09 Apr 2004 Posts: 6321 Location: Holland

|
Posted: Wed Jan 14, 2026 12:50 pm Post subject: |
|
|
The problem is that you did not defined the mode for the timer which is mandatory but not mentioned in the help.
So your code should start with Config Tca0 = Normal ,RESOLUTION=NORMAL followed by the other options. This because the parameters for the 2 modes are different depending on the mode. Whenever the DAT file contains a reference to PARENTOPTION and PARENTVALUE it is important that this parent is defined.
example:
OPTION6=EVENT_ACTIONA
OPTION6VALUE=[DISABLED,ENABLED,COUNT_POS_EDGE,COUNT_ANY_EDGE,COUNT_HIGH_LVL,COUNT_UPDOWN]
OPTION6PARENT=OPTION5
OPTION6PARENTVALUE=NORMAL
Also notice that some processors use EVENT_ACTION, but those with multiple actions use EVENT_ACTIONA and EVENT_ACTIONB _________________ Mark |
|
| Back to top |
|
 |
ok1hdu
Joined: 10 Sep 2018 Posts: 47

|
Posted: Wed Jan 14, 2026 4:07 pm Post subject: |
|
|
Great,
Mark, thanks a lot for the explanation.
Event_ActionA and Event_actionB, that's exactly the case with the Attiny3226 I'm testing here.
I was almost sure I saw it in the configuration menu when I was playing with it a few days ago. And I couldn't figure out why it stopped showing.
Finally I was thinking it was some other timer/counter. Resolution = Normal has zero in the register, so I assumed it is the default, no need to set it.
By the way, how is it possible that it compiled and worked correctly even if I had the wrong syntax?
Event_action without "A".
Jarda |
|
| Back to top |
|
 |
albertsm
Joined: 09 Apr 2004 Posts: 6321 Location: Holland

|
Posted: Wed Jan 14, 2026 9:10 pm Post subject: |
|
|
Yes for the compiler because it is zero you do not need to set it. But the Code Explorer has different options in some cases. And the options are connected to such an option.
Without that you chose one the options are not visible.
The reason it compiles is that the compiler accepts both event_action and event_actionA as the same thing. _________________ Mark |
|
| Back to top |
|
 |
|