Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

interrupt count and easy tcp ip

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
percramer

Bascom Member



Joined: 20 Nov 2006
Posts: 5

blank.gif
PostPosted: Tue Apr 08, 2008 1:13 pm    Post subject: interrupt count and easy tcp ip Reply with quote

Hi all,

i have got the following issue. My current hardware / software design needs to calculate data from 3 counters. The counters all have differtent intervals. I use a Mega32 and i have connected each counter to 1 of the 3 interrupts of the Mega32. When i generates an interrupt i just update an internal variable in bascom quickly. This works fine. But now i would like to change my design to start using an tcp-ip interface instead of the serial port (for communication). I have bought the easy tcp-ip kit for this. This only uses the i2c port and a reset AND an interrupt. So now i have got an interrupt problem, because the mega32 only has got 3 interrupts. What do you think is the best way to solve this?

Combine the output of the 3 counters to 1 interrupt and re-route the outputs of the counters also to 3 inputs? Then on an interrupt check the 3 inputs to see which counter has generated the interrupt?
Back to top
View user's profile
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 375
Location: Wuppertal, Germany

germany.gif
PostPosted: Tue Apr 08, 2008 3:45 pm    Post subject: Reply with quote

good idea.
How long are your input signals?
can┤t you just check the inputs in the main loop?
Have you checked if DEBOUNCE (see help) is a solution?
Back to top
View user's profile
percramer

Bascom Member



Joined: 20 Nov 2006
Posts: 5

blank.gif
PostPosted: Tue Apr 08, 2008 8:43 pm    Post subject: Reply with quote

The Mega128 seems to have more interupts. Maybee that is a good alternative to?
Back to top
View user's profile
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 375
Location: Wuppertal, Germany

germany.gif
PostPosted: Tue Apr 08, 2008 9:18 pm    Post subject: Reply with quote

mega128 is not available in DIL, but shure is a good ÁC.
Why do you stick to interrupts so much?
Back to top
View user's profile
percramer

Bascom Member



Joined: 20 Nov 2006
Posts: 5

blank.gif
PostPosted: Tue Apr 08, 2008 9:37 pm    Post subject: Reply with quote

well because it keeps the design that much easier (at least i think). I don't need to pol 3 inputs for their value (for the 3 external counter, which are a Kwh counter,and 2 flow counters). Just update the internal value when the interrupt fires. checking the 3 inputs in the main loop just doesn't look like the right way to do it (but i could be wrong). The device doesn't need to do much more though. Switch 3 relais and get values from 2 other analog values. It does all that at the moment and output it through the serial port. But i would like to swap this for a ethernet connection (or add an ethernet connection and keep the serial also).

But maybee i am thinking to diffecult and should i just tie the 3 counters together to 1 interrupt....
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2472
Location: Queensland

australia.gif
PostPosted: Tue Apr 08, 2008 11:14 pm    Post subject: Reply with quote

In spite of what all the textbooks say, polling is better for any low speed ( say < 10 ms ) signals than interrupts. Interrupts are for *high* speed, where you want the processor to take notice of some external event in at most a couple of clock cycles. It costs you no significant overhead to poll a port line, compared to the time taken to write to serial ports, displays, and the like. After all that is what all that processor power is for !
_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot 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