Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

hangup when return from int0 with using array

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
karlos

Bascom Member



Joined: 03 Apr 2015
Posts: 107

PostPosted: Sun Nov 15, 2015 2:42 pm    Post subject: hangup when return from int0 with using array Reply with quote

Hi

i want to assign a byte into a 500 byte array.when return from int,some times the microcontroller hangup.

sample code:

dim i as word
dim h(500) as byte

config int0=falling
enable int
on int0 assign_value

do
loop
end

assign value:
incr i
if i>500 then i=1
h(i)=portb
return

what should i do?

thanks


(BASCOM-AVR version : 2.0.7.8 )
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sun Nov 15, 2015 3:29 pm    Post subject: Code not complete? Reply with quote

Perhaps is your code not complete, I see some errors...

assign_value to jump to, but there is only a assign value

enable int should be enable interrupts


dim i as word
dim h(500) as byte

config int0=falling
enable int
on int0 assign_value

do
loop
end

assign value:
incr i
if i>500 then i=1
h(i)=portb
return

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1571
Location: Basel, Switzerland

switzerland.gif
PostPosted: Sun Nov 15, 2015 4:40 pm    Post subject: Reply with quote

Hi,

Are your stacks large enough?
You also need to enable int0 and enable the global Interrupt:-

enable int0
enable Interrupts

regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
karlos

Bascom Member



Joined: 03 Apr 2015
Posts: 107

PostPosted: Sun Nov 15, 2015 8:35 pm    Post subject: Reply with quote

Hi

thank you for note about code

yes,it is not complete code, i write here some part of its for example.

i test all section of my code part by part, all of code is about 800 lines and it is very complicate for reader to debug it, so i write the last code here to show my purpose.

for stack :

$hwstack = 40
$swstack = 40
$framesize = 50

thanks
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR 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