Tuesday, 19 March 2013
Milestag UMT software
Visit Tagbits to see the full range of tagger products described in this blog.
Update: Code finished here
I'm making good progress with my own version of the Milestag UMT software. Since getting the IR receive routine working, I can now control the ISD1790 audio playback chip and have implemented the IR clone and system message processing.
I've also implemented most of the game code. This is implemented as a state machine, with each gun mode having its own state. e.g. InGame, Dead, Re-loading, Hit, Game Over etc.
The interrupt driven IR receive routine passes a packet event (as a flag) to the foreground task, which then takes the appropriate action depending upon the current game state.
I've also got the IR transmit routine working. The PIC generates a 600uS periodic interrupt and implements (yet another) state machine to allow it to track which part of the IR signal it is currently sending. The IR packet consists of a 2.4mS header followed by one's of 1200uS and zeros of 600uS. Each bit has an inter bit delay of 600uS.
Here is a snapshot of the start of a packet:
The long header can be seen at the LHS of the display in between the two vertical lines. Following are a series of long and short pulses for 1's and zeros.
Here is a full packet sending a gun ID of 20 (0x14) and a team ID of 1, and shot power of 2 (0x12). Data is transmitted least significant bit first.
The vertical lines on the show show the start bit (bit 0) of each part of the transmission. The gun ID is 8 bits long and the shot power/team ID is only 6 bits long. See the full Milestag IR protocol documentation here.
All that remains is to modulate the IR signal to 56kHz using the PICs on board PWM.