I have done further tests on this and found an interesting point: when changing the table data to this: PAGA_table ; table with modified values db 0x52, 0x01, 0x51, 0x20, 0x20 ; db 0x52, 0x01, 0x51, 0x01, 0x10 ; db 0x52, 0x01, 0x52, 0x03, 0x20 ; db 0x52, 0x01, 0x52, 0x04, 0x30 note that there is only one line of data, and I after changing the second item from 0x21 to 0x01 the program will run, BUT it will misbehave at following point (which is = long before the table is referenced). ; -------------------------------------------------------------------------= ---- BusFrei ; BusFreizeit von 50 bitzeiten a 104 us =3D5200 us abwarten GLOBAL BusFrei movlw 0x17 ; 23 movwf BusFrCnt ;<<<<----HERE bsf PORTB, 1 bcf AusPort Wait50bit dcfsnz BusFrCnt ; bis hier 4 us, dann 14 us pro Loop ;<<<<----HERE return movlw 0x26 ; =3D 38dec movwf BusFrCnt1 ;<<<<----HERE btfss EinPort ; bit test, skip if set goto BusFrei ; bit was 0 btfss EinPort ; bit test, skip if set goto BusFrei ; bit was 0 decfsz BusFrCnt1 ;<<<<----HERE bra $-8 goto Wait50bit ; -------------------------------------------------------------------------= ---- In this loop, where I wait for the EinPort to stay high during a certain = time, the two variables BusFrCnt1 and BusFrCnt are NOT updated. so I conclude that changing the table has changed the program. any idea how to proceed from here? thanks Lembit ----- Original Message ----- = From: "Lembit Soobik" To: "Microcontroller discussion list - Public." Sent: Friday, September 08, 2006 4:33 PM Subject: Re: [PIC] defining data in Program Memory I have done some experiments in the meantime: In order to use literals instead of hex, I have added 0x20 to my values and could so put them into the table as literals. of course this means I have to subtract 0x20 when I look the values up. This worked - in MPLAB SIM as well as in the target board. The drawback is, I dont have all hex values from 0x00 to 0xff available, which I need for the system. but it showed that the code works. Next I used the (Hex values + 0x20) in the table as hex That worked too. Next I went back to the original values in hex, which gave me the error in the simulator again. to better ilustrate it, here are the tables: ;PAGA_table ; testtable 2: Literal values are plus 0x20 ; data "r!q " ; data "r!q!0" ; data "r!r#@" ; data "r!r$P" PAGA_table ; testtable 1: Hex values are plus 0x20 db 0x72, 0x21, 0x71, 0x20, 0x20 db 0x72, 0x21, 0x71, 0x21, 0x30 db 0x72, 0x21, 0x72, 0x23, 0x40 db 0x72, 0x21, 0x72, 0x24, 0x50 ;PAGA_table ; table with correct values ; db 0x52, 0x01, 0x51, 0x00, 0x00 ; db 0x52, 0x01, 0x51, 0x01, 0x10 ; db 0x52, 0x01, 0x52, 0x03, 0x20 ; db 0x52, 0x01, 0x52, 0x04, 0x30 And here is the code which uses the table. Note that the lines where I subtract 0x20 are comented out. The code worked with these lines, as well as without. the program reads data from a serial bus (4 values) and compares them with the first 4 values of each line in the table. If all 4 values compare true, the 5th value is used to select a line from a different table and display it on the LCD. Lembit BusPr=FCfen ;----------------- movlw UPPER my_table movwf TBLPTRU movlw HIGH my_table movwf TBLPTRH movlw LOW my_table movwf TBLPTRL movf ptr_pos,W addwf TBLPTRL,F clrf WREG addwfc TBLPTRH,F addwfc TBLPTRU,F ;----------------- movlw 0x20 movwf sub20 movlw .0 movwf ptr_pos nextAddress movlw UPPER PAGA_table movwf TBLPTRU movlw HIGH PAGA_table movwf TBLPTRH movlw LOW PAGA_table movwf TBLPTRL movf ptr_pos,W addwf TBLPTRL,F clrf WREG addwfc TBLPTRH,F addwfc TBLPTRU,F tblrd *+ movf TABLAT, W ; movf sub20, W ; subwf TABLAT, 0 cpfseq PAdr1 goto IncAddress tblrd *+ movf TABLAT, W ; movf sub20, W ; subwf TABLAT, 0 cpfseq PAdr2 goto IncAddress tblrd *+ movf TABLAT, W ; movf sub20, W ; subwf TABLAT, 0 cpfseq GAdr1 goto IncAddress tblrd *+ movf TABLAT, W ; movf sub20, W ; subwf TABLAT, 0 cpfseq GAdr2 goto IncAddress tblrd *+ movf TABLAT, W ; movf sub20, W ; subwf TABLAT, 0 movwf ptr_pos call my_char_1 return IncAddress movf dataPoint, W addwf ptr_pos, 1 movf ptr_pos, W cpfseq dataLines goto nextAddress return ;----------------------------- ----- Original Message ----- = From: "Tamas Rudnai" To: "Microcontroller discussion list - Public." Sent: Thursday, September 07, 2006 3:23 PM Subject: Re: [PIC] defining data in Program Memory Try to include that part of the program that uses the PAGA table... we do not need all the code, but if you want you can attach it to the mail or put it someware were we could take a look at, but from this snippet we do not see how do you use the table. Tamas -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- = No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.12.2/441 - Release Date: 07.09.2006 -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist