' ========================================================================= ' ' File...... TEMPLATE.SXB ' Purpose... SX/B Programming Template ' Author.... ' E-mail.... ' Started... ' Updated... ' ' ========================================================================= ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- temp1 VAR Byte ' Temporary variable for main code temp2 VAR Byte ' ------------------------------------------------------------------------- INTERRUPT ' ------------------------------------------------------------------------- ISR_Start: ' ISR code here ISR_Exit: RETURNINT ' {cycles} TX_CHAR SUB 2 ' ========================================================================= PROGRAM Start ' ========================================================================= Pgm_ID: DATA "SX/B Template", 0 ' ------------------------------------------------------------------------- ' Subroutines / Jump Table ' ------------------------------------------------------------------------- TX_CHAR: temp1 = __PARAM1 ' save byte to send temp2 = __PARAM2 ' save number of repeats DO WHILE temp2 > 0 SEROUT rb.1, T9600, temp1 ' send the byte DEC temp2 ' update count LOOP RETURN ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- Start: ' initialization code here Main: 'This subroutine takes two parameters: the first is the byte to transmit and 'the second is the number of times to transmit that byte. 'By using the second parameter sending "**********" is as easy as (when the subroutine is declared with SUB): TX_CHAR "D", 1 TX_CHAR "E", 1 ' send "**********" TX_CHAR "B", 2 ' send "**********" TX_CHAR "I", 1 ' send "**********" TX_CHAR "E", 1 ' send "**********" TX_CHAR " ", 74 pause 1000; GOTO Main