Shop OBEX P1 Docs P2 Docs Learn Events
WATCH error? — Parallax Forums

WATCH error?

Chrisp_ozChrisp_oz Posts: 6
edited 2006-12-19 18:04 in General Discussion
Hi,
I wonder if I'm doing anything wrong. I've been trying to set up a watch for one bit in a register and didn't know why the value shown was always wrong until I·saw the program listing from the compiler:

     1  07FA  0F7F                      device sx28l,oschs3
     2  07FA  0F7F                      device turbo,stackx,optionx
     3  =00000000                       IRC_CAL IRC_SLOW
     4  07FF  0A4C                      reset main_program
     5  =0007A120                       freq 500_000
     6                  
     7                  ;***********************************
     8                  ;Bank definition
     9                  ;***********************************
    10  =00000008       global_org      = $08
    11  =00000010       bank0_org       = $10
    12  =00000030       bank1_org       = $30
    13                  
    14                  ;**********************************
    15                  ;Variable space
    16                  ;**********************************
    17                  
    18                  ;Global area
    19  =00000008                       org global_org
    20                  
    21  =00000008       flags   ds 1
    22  =00000008               time_elapsed    equ flags.0 ;Time to collect another sample
    23  =00000008.1             half_deg        equ flags.1 ;.5 degrees more
    24  =00000009       time_cntLB      ds 1
    25  =0000000A       time_cntHB      ds 1
    26  =0000000B       wait_cnt        ds 1
    27  =0000000C       temp_value      ds 1
    28  =0000000D       temporary       ds 1
    29                  
    30  =00000007.5     DS_RST          equ rc.5        ;Reset line for DS1620
    31  =00000007.6     DS_CLK          equ rc.6        ;Clock line for DS1620
    32  =00000007.7     DS_DQ           equ rc.7        ;Data line for DS1620
    33                  
    34                  ;Messaging data area BANK 0
    35  =00000010                       org bank0_org
    36  =00000010       mesg_data       ds 1
    37  =00000011       mesg_in_data    ds 1
    38  =00000012       bit_counter     ds 1
    39                  
    40  =0000000C                       watch temp_value,8,udec
    41  =00000010                       watch mesg_data.0,1,udec
    42  =00000108                       watch flags.1,1,udec
    43  =00000008                       watch flags,8,ubin

At the bottom, looking at the watch statements, flags.1 points to address $108 instead of $008. Why is that? I tried udec and ubin with similar results.
Thanks
Christian

Comments

  • PJMontyPJMonty Posts: 983
    edited 2006-12-17 05:01
    Christian,

    If I recall correctly, the "1" in "$108" tells the SX-Key which bit to watch. Try changing the bit number and you should see that value change to match it. Also, there was a problem watching individual bits that I thoought was fixed. I'll have to see if it's there is still a problem. In the meantime, just watch the entire byte and check for the status of the bit by eye.
      Thanks, PeterM
  • Chrisp_ozChrisp_oz Posts: 6
    edited 2006-12-17 05:59
    Thanks Peter. I was going crazy looking at the the Watch window not understand why everything was so strange.

    I forgot to add one thing, when I change the bit in the watch window, instead of changing bit 1 in register $008, I can see bit 1 in register $118 change instead.
    I'm using SX-Key v3.2.3, is there a newer version than this?
    Thanks
    Christian
  • pjvpjv Posts: 1,903
    edited 2006-12-17 08:12
    Hi P.J.

    I believe there still is a problem, and as I recall (not positive) it's different for registers in bank 0 versus other banks.

    Could you please explain how they should work ? As I recall, they dont work like the description in the manual.

    Cheers,

    Peter (pjv)
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2006-12-19 18:04
    I asked about this condition a while ago. See this thread. In summary, watching a bit variable that is within the global memory space does not function properly. To work around this either watch the entire byte as PJMonty has suggested or arrange your variables differently so that that byte with the bit you wish to watch lies outside the global address space.

    - Sparks
Sign In or Register to comment.