Shop OBEX P1 Docs P2 Docs Learn Events
Need help with SX interrupts — Parallax Forums

Need help with SX interrupts

ShaileshShailesh Posts: 4
edited 2005-05-06 13:37 in General Discussion
Hello All,

I am currently working on a system where i have to program an SX 52 largely to transfer data between some ADCs, DACs, an interpolator card (all on ane side) and a PC.

I have faced problems with the SX 52 interrupts, a summary is as follows.

1) When i enter the·ISR, i make it a point to disable all interrupts so that the ISR goes thru w/o a hitch. There are no sporadic interrupts, rather the interrupts are used to implement a communication protocol so i guess i shuld not be missing out on any interrupts. Trouble is that inspite of the interrupts being disabled, the program reverts from within the ISR to the start of the ISR when i toggle a specific pin! the pin in question is RD3 and has absolutely no connections to port B.

2) Every time i read the WKPND register, it shows values such as 38,18,19 etc. when·it should always contain either 10 or 00 as i have enabled only one interrupt on pin RB.4. All other interrupts have not been enabled. I am adding here the piece of code so u can see if i am doing anything wrong:
··
·· mode ·$1A··;Make interrupt O_TRG Rising edge active
···mov·W,#$FF
···mov·!rb,W

·· mode ·$19··;Clear the WKPND reg
···mov·!rb,W
···clr·W
···mov·!rb,W

·· mode·$1B··;Enable interrupt on pin 4 i.e. O_TRG
···mov·W,#$EF
···mov·!rb,W

Please note that i am using only external interrupts and NO MIWU or RTCCs. Also, i find the info in the datasheet a bit sketchy at best and would be indebted if somebody could throw a little bit of light on the differences between the MIWUs and the external interrupts.

I look forward to your replies

Best Regards,
Shailesh

Comments

  • pjvpjv Posts: 1,903
    edited 2005-04-26 16:23
    Hello Shailesh;

    I'm not sure if this is related to your problem, but be aware that on the SX48/52 you can not use direct MODE assignments, as that only sets the lowest 4 bits. For the SX28 that works fine, but for the SX52 you need 5 bits, so set w to the desired mode value, then move w to m.

    MOV W,#MODEVALUE
    MOV M,W

    Since we can only see your code snippet, I hope that fixes your problem.


    Peter (pjv)
  • ShaileshShailesh Posts: 4
    edited 2005-05-06 13:37
    Hello Peter,

    Thanks for the suggestion. Although i am afraid the fault lay elsewhere in the code. i had a pair of lines of code to read the WKPND register after clearing it (was being overly cautious and doubting the abilities of the SX smile.gif It was this exchange where these funny values would make their way to the WKPND register and cause unnecessary interrupts. now that segment of code works just fine and i can concentrate elsewhere.

    Thanks again,

    Shailesh

    P.S. Your suggestion did help me at another location where i wanted to enter mode 1F but kept entering mode 0F. In case of the interrupts it dint really matter but here it did. So thanks once again!
Sign In or Register to comment.