David Thompson wrote: > ;********************************************************** > ;* Data tables > ;********************************************************** ; *** Reserve TWO bytes for table_offset *** > command movlw table_offset ;Get high 5 bits of table address movwf PCLATH ;Preload high address ; PCLATH must be set *in* the subroutine, not *before* it movf table_offset+1,w ;Transfer low address movwf PCL ; to PCL ; Data tables (may be anywhere in memory) > off_hook > dt 0x07,"AATDT;",0x0d > hang_up > dt 0x05,"AATH",0x0d > modem_reset > dt 0x05,"AATZ",0x0d > dummy_dial > dt 0x17,"AATM2S07=48DT,xxxxxxxx",0x0d > ; macro send_command where movlw HIGH where ;table high address movwf table_offset movlw LOW where ;table low address call do_send endm > You can call up one of these modem strings by simply doing this... send_command modem_reset ;reset string > ;********************************************************* > ;* Send modem command string - called with table offset in w > ;********************************************************* do_send movwf table_offset+1 ;Save table offset call command ;Get first byte (string length) movwf msg_length ;Save message length send_next incfsz table_offset+1,f ;Increment table offset incfsz table_offset,f ; including high byte call command ;Jump to table > loop_com > btfss PIR1,TXIF ;Check if txreg empty > goto loop_com ;Loop until free > ; > wait_CTS ;Hardware flow control. CTS norm LOW > btfsc PORTB,CTS ;Are we clear to send? > goto wait_CTS ;If CTS = HIGH, modem is busy > gie_tx > bcf INTCON,GIE ;Disable interrupts, dammit! ; But - why? > btfsc INTCON,GIE > goto gie_tx > movwf TXREG ;Send byte to modem > bsf INTCON,GIE ;Re-enable interrupts > decfsz msg_length,f ;Decrement length, if not zero > goto send_next ;Keep going... > return E&OE of course ;-) -- Cheers, Paul B.