; spam.asm ; Doug Ricket, 6-24-01 ; ; This program prints all ascii characters to the serial port main: acall serialinit ; set up the serial port mainloop: mov a, #'s' ; Load a with the 's' character acall sndchr ; Transmit A through the serial port mov a, #'p' acall sndchr mov a, #'a' acall sndchr mov a, #'m' acall sndchr mov a, #' ' acall sndchr sjmp mainloop ; Local GOTO mainloop ; ******** Support routines are below *********** serialinit: ; set up serial port with a 11.0592 MHz crystal, ; use timer 1 for 9600 baud serial communications (19200 for RD2 chip) mov tmod, #20h ; set timer 1 for auto reload - mode 2 mov tcon, #41h ; run counter 1 and set edge trig ints mov th1, #0fdh ; set 9600 baud with xtal=11.059mhz mov scon, #50h ; set serial control reg for 8 bit data ; and mode 1 ret ;=============================================================== ; subroutine sndchr ; this routine takes the chr in the acc and sends it out the ; serial port. ;=============================================================== sndchr: clr scon.1 ; clear the tx buffer full flag. mov sbuf,a ; put chr in sbuf txloop: jnb scon.1, txloop ; wait till chr is sent ret