View previous topic :: View next topic |
Author |
Message |
dmitrboristuk
Joined: 26 Sep 2020 Posts: 58
|
Problems with using BRA/BRW |
Posted: Thu Jan 23, 2025 1:08 am |
|
|
The program uses two LUTs. One of them is used in the ISR, the second in the main code. The table used in the ISR works perfectly. But the table in the main code has no effect. The number is not extracted. Are there any recommendations for placing tables in program memory? There is also a PIC12LF1552 Silicon Errata and Data Sheet Clarification where 1.1 BRA/BRW have problems. I use a PIC16f1619. Have you encountered similar behavior?
Code: |
static int8 LUT_ISR[30]={0, 90, 0, 0...90, 45};
static int8 LUT_MAIN[174]={0,8,16,67...34,56};
|
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19619
|
|
Posted: Thu Jan 23, 2025 2:08 am |
|
|
Critical question.
What compiler version?????.
Generally CCS will have fixes for problems like this (unless you use the device
editor and turn them off), but sometimes when new issues are reported, these
fixes may not appear for a few compiler versions.
You say the lookup does not work. How are you testing this?. Are you sure
the code is actually executing this part of the main?. |
|
|
dmitrboristuk
Joined: 26 Sep 2020 Posts: 58
|
|
Posted: Thu Jan 23, 2025 2:27 am |
|
|
5.115
In the assembler code everything looks great
I'll write more details later, I'm leaving
Code: |
int16 X, Y;
int8 nomb;
Y = 855 + main_lut[nomb] + X;
|
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19619
|
|
Posted: Thu Jan 23, 2025 4:11 am |
|
|
What you post refers to a different table to what you earlier showed.
main_lut versus lut_main....
Are you sure you have not gt something declared called main_lut, and hence
it is not actually accessing the table you think?..... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19619
|
|
Posted: Thu Jan 23, 2025 8:16 am |
|
|
That only applies if an interrupt occurs during the instruction. So try the
experiment of disabling the interrupt before doing the table lookup. If is
starts working, you have identified the problem.
It is very unlikely that your chip has this problem. Somebody would have
seen it if so, and it'd be in the errata for your chip. |
|
|
|