PSoC >> PSoC Mixed-Signal Array

Pages: 1
Filippo - ELMARC
stranger


Reged: Apr 17 2008
Posts: 4
BUG BUG BUG!!! in array index operation
      #51892 - Wed Apr 23 2008 04:57 AM

look this code:

;input_drv.c: 513: SM.Output.LedStatus = ManualTest_Led_Table[SM.ProgramStatus.PhaseStepIndex];
51 20 mov a, [(_SM+10)^0]
64 asl a
01 00 add a, <_ManualTest_Led_Table
5C mov x, a
50 1E mov a, >_ManualTest_Led_Table
08 push a
28 romx

ManualTest_Led_Table is defined as follow:
const u_int16 ManualTest_Led_Table[]
and as you can see is placed at 0x1E00

then we want substract 1 in the table index index:

;input_drv.c: 515: else SM.Output.LedStatus = ManualTest_Led_Table[(SM.ProgramStatus.PhaseStepIndex - 1)];
51 20 mov a, [(_SM+10)^0]
64 asl a
01 FE add a, <(_ManualTest_Led_Table+-2)
5C mov x, a
50 1D mov a, >(_ManualTest_Led_Table+-2)
08 push a
28 romx

The MSB of ManualTest_Led_Table is always 0x1D and is wrong!

if we try to cast the result:

;input_drv.c: 515: else SM.Output.LedStatus = ManualTest_Led_Table[(u_int08) (SM.ProgramStatus.Phase
StepIndex - 1)];
51 20 mov a, [(_SM+10)^0]
64 asl a
01 FE add a, <(_ManualTest_Led_Table+254)
5C mov x, a
50 1E mov a, >(_ManualTest_Led_Table+254)
08 push a
28 romx

that is wrong with SM.ProgramStatus.PhaseStepIndex = 0


Post Extras: Print Post   Remind Me!   Notify Moderator  
clydeAdministrator
HI-TECH team member
*****

Reged: Oct 16 2003
Posts: 470
Re: BUG BUG BUG!!! in array index operation [Re: Filippo - ELMARC]
      #53362 - Thu May 01 2008 06:01 AM

This problem is fixed in the latest build - you can download it from here:

http://updates.htsoft.com/psoc/HCPSOC-pro-9.61PL1.2232.exe


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 0 anonymous users are browsing this forum.

Moderator:  ndouglas, Dan Henry, jtemples, jeff, garth, Andrew L, Ryan, mikerj 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 631

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5