| ??? 06/30/03 04:33 Read: times |
#49676 - RE: Why not use QBASIC? Responding to: ???'s previous message |
Dan, I made this code I tried to make it work, but I had the following problems.
1) the 8051 runs out of stack 2) I´m not able to use constants defines by equ its not very long, if you realize what i´m doing wrong please let me know thanks a lot .ORG 0H ;locate routine at 00H AJMP START ;jump to START .ORG 03H ;external interrupt 0 RETI .ORG 0BH ;timer 0 interrupt RETI .ORG 13H ;external interrupt 1 RETI .ORG 1BH ;timer 1 interrupt RETI .ORG 23H ;serial port interrupt ACALL START_SENDING .ORG 25H ;locate beginning of rest of program ;INICIO_TABLA EQU $40 ;FIN_TABLA EQU $FF SEND: MOV SBUF, A ;Transmit Byte WAIT: JNB TI, WAIT ;Wait for transmission to be completed. CLR TI ;Clear Transmit Flag RET START_SENDING: ;Main program (on power up, program jumps to this point) PUSH ACC PUSH PSW ;Set up control registers MOV PCON,#$80 ;to double baud rate MOV TH1, #0FDH ;Set up for 9600 baud rate MOV SCON, #01010000B ;Mode = 8 bit UART MOV TMOD, #00100001B ;Sets Timer1 to 8 bit auto reload MOV TCON, #01000000B ;Turns Timer1 on ;MOV R0,INICIO_TABLA MOV R0,#$40 LOOP: MOV A,@R0 ;Move Value in R0 to A (to be sent) CALL SEND ;Send Value to PC INC R0 ;Increase the 8 bit value of R1 by 1 MOV A,R0 ;CJNE A,FIN_TABLA,LOOP ;Go to LOOP(jump back to point labeled LOOP) CJNE A,#$FF,LOOP POP PSW POP ACC RETI ;End program START: MOV IE,#$90 JMP $ END |



