Hi, finally I was able to clear all the clouds. > BSF INTCON, GIE ; Again, is this code necessary? This is one of the pitfalls. Thanks Olin, as well as Omer. I thinks this the reason why the PIC ran for some time, and then halted. I was introducing a nested interrupt, and the stack was trashed. The second pitfall is the paging problem. HEX2ASC ;*************************************************************************** *** ; Description: Convert W lower 4 bits to ASCII table defined in HD44780 ; ; B7 B6 B5 B4 B3 B2 B1 B0 ; x x x x B3 B2 B1 B0 ; ; Conditions: Value to be converted in W (4 LSB) ; Result of conversion (8-bits) in W ; ;*************************************************************************** *** ANDLW 0x0F MOVWF W0 MOVLW HIGH TABLE_ASCII MOVWF PCLATH MOVLW LOW TABLE_ASCII ADDWF W0, W SKPNC INCF PCLATH, F MOVWF PCL TABLE_ASCII RETLW 0x30 ; '0' RETLW 0x31 ; '1' RETLW 0x32 ; '2' RETLW 0x33 ; '3' RETLW 0x34 ; '4' RETLW 0x35 ; '5' RETLW 0x36 ; '6' RETLW 0x37 ; '7' RETLW 0x38 ; '8' RETLW 0x39 ; '9' RETLW 0x41 ; 'A' RETLW 0x42 ; 'B' RETLW 0x43 ; 'C' RETLW 0x44 ; 'D' RETLW 0x45 ; 'E' RETLW 0x46 ; 'F' Originally that is only 'ANDLW 0x0F' and 'ADDWF PCL, F' instead of the first 9 line of codes. When I was first writing this code, it stay below 0x100 of page 0. As codes are added little by little, it is pushed out the 0x100 boundary. One question is will this codes work in pages other than page 0? Of course then I have to use the FCALL macro, but will this code work without effecting other paging issue. Jan, I thinks this is the reason I get funny things shown in LCD. Thanks a lot for your response. Regards, WH Tan -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body