Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

AtXtiny TCA0 Event_Action (just for info)

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR XTINY/MEGAX/AVRX
View previous topic :: View next topic  
Author Message
ok1hdu

Bascom Member



Joined: 10 Sep 2018
Posts: 47

czechrepublic.gif
PostPosted: Tue Jan 13, 2026 5:04 pm    Post subject: AtXtiny TCA0 Event_Action (just for info) Reply with quote

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
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6321
Location: Holland

blank.gif
PostPosted: Tue Jan 13, 2026 8:56 pm    Post subject: Reply with quote

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
View user's profile Visit poster's website
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 1182

poland.gif
PostPosted: Tue Jan 13, 2026 9:02 pm    Post subject: Reply with quote

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". Very Happy Im patient and wait when Mark add this into the Code Explorer syntax Very Happy
Back to top
View user's profile Visit poster's website
ok1hdu

Bascom Member



Joined: 10 Sep 2018
Posts: 47

czechrepublic.gif
PostPosted: Tue Jan 13, 2026 9:41 pm    Post subject: Reply with quote

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
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6321
Location: Holland

blank.gif
PostPosted: Wed Jan 14, 2026 12:50 pm    Post subject: Reply with quote

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
View user's profile Visit poster's website
ok1hdu

Bascom Member



Joined: 10 Sep 2018
Posts: 47

czechrepublic.gif
PostPosted: Wed Jan 14, 2026 4:07 pm    Post subject: Reply with quote

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
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 6321
Location: Holland

blank.gif
PostPosted: Wed Jan 14, 2026 9:10 pm    Post subject: Reply with quote

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
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR XTINY/MEGAX/AVRX All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum