Shop OBEX P1 Docs P2 Docs Learn Events
RTCC as general interrupt pin — Parallax Forums

RTCC as general interrupt pin

lajkolajko Posts: 7
edited 2008-05-24 17:38 in General Discussion
For a pipe organ project, I plan to use the B and C ports as 16 inputs and use the SX-28 to debounce the keyboard contacts (16 per chip) and use the A port for serial communication to the organ relay system. I only need 1 critical timing signal, and the software would be "cleaner" if the B and C ports were inputs for 16 keys. Can the RTCC pin be programmed as an interrupt to interrupt on each pulse rather than being used as a counter (which then interrupts when it reaches zero). The organ relay system has 2 control lines: a clock, and a "sync" (which occurs every 128 clock pulses). The SX-28's would be cascaded so serial data out goes from one to the other as if using 74165 serial shift registers (except that the SX-28's can debounce and do a few other organ related tasks).

I could use the C, A and half of the B ports as inputs and a couple bits of the B for the clock interrupt, but it would be cleaner code if the entire B was input rather than using half of the B and the 4 bits of the A port for 8 bits of input (C being the other 8 bits) and the RTCC input for the clock interrupt/input.

By the way, there will be one final SX-28 which will combine the data from the SX-28's (4 for a 61 note keyboard or 2 for a 32 note pedal board), will generate midi output (as a new feature) as well generate the proper data that feeds into the existing organ control system (which will be based off of a master clock and sync signal for the entire organ which comes from a "master clock" board already in the organ).

So is his possible or should I go to the extra effort of using half of the B port for the interrupt? It would be nice, so the A port can be the sync input plus the serial out from one schip to the serial into the next or to the master SX28 ( with this decision still to be determined)

SX-28's could be cascaded to be a 16 bit parallel load shift registers with software contact debouncing. (The "Sync" pulse in conjunction with a clock pulse is a "load" indication. Clock without "Sync" the clock is just a shift signal)

I've done all of this before with Z-80's but due to the low cost and low parts count, and it is a simple control task, the SX-28 now seems to be the best way to design a new board for organ keyboard and pedal input . I need a new board for hall effect switches to add into existing electronic organs and as well as +12 or -12 volt keying for existing pipe organs . One SX-28 that can input 16 keys is about the same cost as 2 74165's (ok, it could be 74LS165, 74HC165 or whatever) to input 16 key contacts and the SX-28 can do debouncing and other things.

Any thoughts on this for the TRCC input as an interrupt?

Comments

  • JonnyMacJonnyMac Posts: 9,216
    edited 2008-05-24 14:57
    If you setup the RTCC for external input and load the RTCC register with 255 at the end of your interrupt code you should get an interrupt on every input of the RTCC, right?
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2008-05-24 15:48
    Lajko,

    do the keyboards have contacts that all connect to one common bus bar when a key is pressed, or do you have any chance to assign the contacts into some matrix scheme. This would save you a lot of I/O lines, and the SX is fast enough to scan such a matrix, handle the necessary de-bouncing, and the serial communication. In this case, I would suggest not to define some "tricky timed" proprieatary serial protocol. but directly use MIDI instead.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • BeanBean Posts: 8,129
    edited 2008-05-24 17:38
    Jon, has the right idea.
    Setup the OPTION register to clock RTCC from the external pin, and set it to clock on rising edge or falling edge as you need.

    Then do:

    INTERRUPT
    ' Your code here
    RETURNINT 1

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?

    www.iElectronicDesigns.com

    ·
Sign In or Register to comment.