try twice... Hello to all, I have to programm a TI MSP430 in Forth. My problem is, that I'm not able to write in the status register or in IE1. I can write in other control registers like the ADC12CTL1 e.g. but i can't handle the interrupts. I'm using the following forth code to call the command "DINT": code /DisableInt DINT RET end-code It also dosn't work when I'm using code /DisableInt 8 # SR & bic.b RET end-code And there is no fault or problem when I want to write anything to IE1. There's just no change in IE1 after writing. Does anybody knows what's my mistake? What do I have to attend before writing to IE1 or before using the DINT-Command? Thank you, Chris

MSP430 / Interrupts / Status Register
Started by ●October 9, 2004
Reply by ●October 9, 20042004-10-09
In article <3b771918a4641563fe3606c72aa6a4de@localhost.talkaboutelectronicequipment .com>, christian@nospam says...> try twice... > > Hello to all, > > I have to programm a TI MSP430 in Forth. My problem is, that I'm not able > to write in the status register or in IE1. I can write in other control > registers like the ADC12CTL1 e.g. but i can't handle the interrupts. > > I'm using the following forth code to call the command "DINT": > > code /DisableInt > DINT > RET > end-code > > It also dosn't work when I'm using > > code /DisableInt > 8 # SR & bic.b > RET > end-code > > And there is no fault or problem when I want to write anything to IE1. > There's just no change in IE1 after writing. > > Does anybody knows what's my mistake? What do I have to attend before > writing to IE1 or before using the DINT-Command? > > Thank you, > > Chris > > >My Forth assembly is a little rusty, but it appears you are ANDing the immediate value 8 with the ADDRESS of SR. Thus, there is an argument missing for BIC.B, which requires a bit number and a register address. Regardless, are you trying to use this word inside an interrupt handler? SR might be being restored to whatever its contents were before the interrupt was taken when RETI is called, overwriting your change... --Gene
Reply by ●October 11, 20042004-10-11
Hi, Thank you. The problem is that GIE is set to "0" only in the code structure. After "END-CODE" it is reset to "1". It's set to "1" if there's no "RET", too. Do you know a solution for my problem? Is there any other possibility for writing to SR without Assembler? kind regards, Chris
Reply by ●October 11, 20042004-10-11
In article <01c9f13a9af87356ac2005dfef1d0fc3 @localhost.talkaboutelectronicequipment.com>, christian@nospam says...> Hi, > > Thank you. The problem is that GIE is set to "0" only in the code > structure. After "END-CODE" it is reset to "1". It's set to "1" if there's > no "RET", too. Do you know a solution for my problem? > Is there any other possibility for writing to SR without Assembler? > > kind regards, > > ChrisThere's a couple of possibilities: There may be a variant form of END-CODE, that does not attempt to restore the status register. If not, you could write your own. Disassemble END-CODE, remove the code that is restoring SR, and create END-CODE-NO-SR, or whatever. There is likely a word for register access that can be called to modify SR without using CODE. --Gene
