;This code is listed here for entertainment value only, it should ;not be used for anything important. Do not use this for a saleable product. ;Feel free to pass this on to others in it's entirety. along with this message. ;No Guarantees implicit or otherwise are implied, your mileage may vary. $RB(0) $RB(1) $NOMOD51 INCLUDE(87C752.pdf) $INCLUDE(common.inc) EXTRN CODE(_MAIN) PUBLIC CRH0 USING 0 USING 1 USING 2 USING 3 CLIBC SEGMENT CODE RSEG CLIBC ; RESET HANDLER CRH0: MOV SP,#LOW CSTACK ; INITIALIZE STACK POINTER MOV PSW,#00 ; CLEAR PSW MOV R0,#IBUFSTART ; SET head of circular character input buffer. MOV R1,#IBUFSTART ; SET tail of circular character input buffer. SETB RS0 MOV R0,#OBUFSTART ; SET head of circular character output buffer. MOV R1,#OBUFSTART ; SET tail of circular character output buffer. CLR RS0 MOV IE,#1 ; only set external interrupt 0 to enabled MOV COL,#0 ; set lcd column to zero MOV ROW,#0 ; set lcd row to zero MOV I2CON,#0 ; I have no idea what I'm doing here. MOV PWENA,#1 ; Set PWM output for LED status. MOV PWMP,#128 ; Use a low frequency. MOV PWCM,#128 ; Start out with a neutral color. SETB KP_R1 ; Ensure all keypad rows are floating high SETB KP_R2 SETB KP_R3 SETB KP_R4 CLR SWR ; Don't screw up the common write between ; other keypads MOV ADCON,#(ENADC OR ADCS OR AADR1) ; Enable A/D converter, and select input 2. MOV P3,#LOW(NOT (EN OR EN2)) ; set up P3 for lcd & keypad SETB EA ; Set interrupts to enabled. AJMP _MAIN ; Execute main loop ?STACK SEGMENT IDATA RSEG ?STACK CSTACK: DS 1 ; SYSTEM STACK $EJECT END