Andrew Warren wrote: > Mark Dennehy wrote: > > > Has anyone using an ICEPIC come across the problem of having some > > registers act funnily ? (ie. not incrementing on an INCF > > ,F and then later returning absurd values ???) > > Mark: > It could be an ICEPIC bug, but before you make that assumption, you > should check to be SURE that: > 1. You've actually loaded the ICEPIC's program memory with the > program whose source code you're single-stepping through. That would sound funny to me if I hadn't done that three times over the last month ... :) > 2. The correct register-page is selected when your "INCF" is > executed. Yes, it's relocatable code and there's a BANKSEL statement in front of it, as shown at the end of this message. > 3. An interrupt is corrupting the register in question. That's something I though might be happening, but I've single-stepped thgough the code and the interrupts don't do anything to the value in temp. Here's the relevant code : USART_TEMP UDATA temp RES 1 ;--------------------ROUTINE SPECIFICATION------------------- ; ; NAME : USART_puts ; ; FUNCTION : Takes a string in ROM and sends it ; down the serial line ; ; INPUTS : The address of the string in USART_hi_msg_tmp ; and USART_lo_msg_tmp. ; ; OUTPUTS : W is 0 if successful, otherwise W holds ; an errorcode ; ; CALLS : USART_putc ; USART_message_table ; ; CALLED BY : ; ; NOTES : ; ;------------------------------------------------------------ ; REVISION HISTORY : ; ;------------------------------------------------------------ ;USART_PUTS ; Move the address of the string table into a temporary pointer. USART_puts CODE USART_puts GLOBAL USART_puts EXTERN USART_hi_msg_tmp EXTERN USART_lo_msg_tmp EXTERN USART_message_table BANKSEL temp clrf temp ; Get the character at that address, USART_puts_loop PAGESEL USART_message_table movf temp,W call USART_message_table ; If the character is not a NUL, xorlw 0 btfsc STATUS,Z goto USART_puts_msgdone movwf tmpchar ; putc that character, PAGESEL USART_putc movf tmpchar,W call USART_putc ; increment the pointer and reloop BANKSEL temp incf temp,F goto USART_puts_loop ; if the character is a NUL, that's the end of the string, ; so clear temp and return 0 USART_puts_msgdone retlw 0 -- Mark Dennehy, B.A., B.A.I. Email : Mark.Dennehy@cs.tcd.ie Research Student, Computer Vision and Robotics Research Group, Computer Science Dept., Trinity College Dublin