|
|
View previous topic :: View next topic |
Author |
Message |
julian_lpp
Joined: 26 Apr 2011 Posts: 3
|
16 bits and interrupts |
Posted: Tue Apr 26, 2011 7:02 pm |
|
|
I'm wondering if everytime some stuff related with 16-24-32 bits is involved, the CCS compiler turns off the interrupt (global) flag ????
I'm starting to build a pretty simple C-to asm converter, and basic things like reading the Timer1, makes me think whether I have to turn off interrupts or not, cause I can imagine this scenario:
read 1st byte of Timer1 --- lets say the 2nd byte were 0x0A
Interrupt! -> some cycles to handle this
read 2nd byte of Timer1 error! it's not 0x0A anymore
So, should I disable interrupts every time 16bits or more op are involved??
regards
julian |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 26, 2011 7:19 pm |
|
|
Quote: | I'm wondering if everytime some stuff related with 16-24-32 bits is
involved, the CCS compiler turns off the interrupt (global) flag ???? |
It's not automatic. You have to do it manually in code. You can make
a test program and see this. |
|
|
julian_lpp
Joined: 26 Apr 2011 Posts: 3
|
|
Posted: Wed Apr 27, 2011 2:44 pm |
|
|
PCM programmer wrote: |
It's not automatic. You have to do it manually in code. You can make
a test program and see this. |
Great to know that, so basically CCS is written, in this particularly case, with "take care yourself" sort of behavior. I think I'll take the same path.
Not knowing very well If it's correct to continue in the same thread, I'll ask anyway cause I think it's related with the original topic.
How CCS handle the functions calls? I mean, there are at least 2 ways of solving some simple code like the following:
i = getInt8Val()
1)
CALL GETINTVAL
MOVFW RESULT
MOVWF i
GETINTVAL:
----
----
----
----
more than 3 lines here
MOVWF RESULT
return
2)----
----
----
----
more than 3 lines here
MOVWF i
In the first case there'll be less rom consumed (assuming several GETINTVAL calls), but an auxiliary TEMP var would be necessary (plus the extra cycles to run the code)
The second code would waste more rom, but less ram and speeder than the first..
Note that I cant have access to a CCS compiler right now, that's why I'm asking
regards,
julian |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9216 Location: Greensville,Ontario
|
|
Posted: Wed Apr 27, 2011 2:52 pm |
|
|
All compilers are a compromise between speed and memory.You can cut code for either but not both at the same time.If you want speed, hand assemble code, try it, go back and 'tweak' until you get the performance you want.
As to how CCS does it, just dump the listing and read it, it's all there, open to the public to view. |
|
|
julian_lpp
Joined: 26 Apr 2011 Posts: 3
|
|
Posted: Wed Apr 27, 2011 3:02 pm |
|
|
temtronic wrote: | All compilers are a compromise between speed and memory.You can cut code for either but not both at the same time.If you want speed, hand assemble code, try it, go back and 'tweak' until you get the performance you want. |
Understood, It's just I'm fairly new to C to asm conversion, I just started to be able to assemble some rudimentary "Ladder Logic Code" for free, and use MPLAB. Hope I'm still wellcomed here in the ccs forum (a pretty good compiler by the way)
I'm now able to assemble a complete "main" function, with "n" nested whiles, fors, if's eetc, built_in function calls inside them (not expressions inside function's arguments yet). And only 8 bits math for the moment. I hope I can upload it and let users test and help me to find the thousands of bugs I'm sure it has. I's written entirery in..... PHP
temtronic wrote: |
As to how CCS does it, just dump the listing and read it, it's all there, open to the public to view. |
Cant have access right now sadly, I'll try to watch it as soon as posible.
regards,
julian |
|
|
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|