I have been having a problem where my program resets itself at random times in my code, so I used the mplab simulator software and found that in one routine when I try and modify the PCL (program counter right?) to make it jump forward in the code a few lines, it jumps to a random place in code far from what was intended. So basically, do you see any memory problems in this section of code, especially around where you see the cblock? If not what typically causes the PIC to reset itself? I don't include the code where the problem actually occurs for brevity and I am also pretty certain that my problem lies in this section here. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LIST p=16F628 ;tell assembler what chip we are using include "P16F628.inc" ;include the defaults for the chip ERRORLEVEL 0, -302 ;suppress bank selection messages __config 0x3D18 ;sets the configuration settings (oscillator type etc.) ;__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _LVP_OFF & _MCLRE_OFF #define RXBIT PORTB, 3 #define IF_SHORT flags, 0 #define FIRST_HALF flags, 1 #define HEADER flags, 2 #define VALID flags, 7 if_short_val EQU 1 ; bit value of IF_SHORT flag first_half_val EQU 2 ; bit value of FIRST_HALF flag cblock 0x20 ;start of general purpose registers count ;used in looping routines count1 ;used in delay routine counta ;used in delay routine countb ;used in delay routine tmp1 ;temporary storage tmp2 templcd ;temp store for 4 bit mode templcd2 endc bitcnt res 1 tmrval res 1 ; timer value bt res 1 ; receive byte buffer flags res 1 ; decode logic status btcnt res 1 ; byte counter agetmr res 1 ; age out timer buffer res 4 ; receive packet buffer bsum res 1 ; receive buffer, checksum ;FOR LCD LCD_PORT Equ PORTA LCD_TRIS Equ TRISA LCD_RS Equ 0x04 ;LCD handshake lines LCD_RW Equ 0x06 LCD_E Equ 0x07 hdrcntmin EQU 0x0c hdrcntmax EQU 0x10 min_t EQU .34 min_2t EQU .104 max_2t EQU .174 age_max EQU .15 ; age out last valid packet packet_len EQU 5 ; packet length, check var. alloc! devid1 EQU 0x9a devid2 EQU 0xe9 org 0x0000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;begin normal code execution;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Richard Zinn Software Engineer richardz@omniture.com 801.722.7000 ext. 158 tel 801.319.6078 cel Omniture http://www.omniture.com "Unique Questions, Precise Answers" -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads