• AVR Freaks

Hot!Data initialisation using .data

Author
Denge
Super Member
  • Total Posts : 104
  • Reward points : 0
  • Joined: 2016/03/03 07:23:12
  • Location: belgium
  • Status: offline
2020/06/10 12:21:43 (permalink)
0

Data initialisation using .data

Hi All,
 
I'm using the .data directive to define two constants
.data
fp_ClkPrd: .float 6.25e-9 ; Clock period 62,5 ns
fp_CalPrd: .float 9 ; Number of calibration periods
 
Once assembled in the simulator I can find the labels in the data memory, but they contain zero.
when I assemble on the realIce, these constants contain something, but not the values intended.
Did I overlook something?  Or are there things I missed?
 
Any clue would be appreciated.
 
 
pic33EP512GP502
MPLAB X IDE v5.35
XC16 V1.50
 
#1

5 Replies Related Threads

    MBedder
    Circuit breaker
    • Total Posts : 6919
    • Reward points : 0
    • Joined: 2008/05/30 11:24:01
    • Location: Zelenograd, Russia
    • Status: offline
    Re: Data initialisation using .data 2020/06/10 13:17:01 (permalink)
    5 (1)
    Go back to school and learn the assembler basics. Only come back when done.
    #2
    Denge
    Super Member
    • Total Posts : 104
    • Reward points : 0
    • Joined: 2016/03/03 07:23:12
    • Location: belgium
    • Status: offline
    Re: Data initialisation using .data 2020/06/10 14:32:00 (permalink)
    0
    Hi Embedder,
    No problem to go back to school for me! I know i overlooked something and maybe a simply hint or which doc to dig in would be helpful to get on track 
    #3
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3992
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: Data initialisation using .data 2020/06/10 16:04:15 (permalink)
    3 (2)
    This should help:
    XC16 ASSEMBLER, LINKER AND UTILITIES

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #4
    Denge
    Super Member
    • Total Posts : 104
    • Reward points : 0
    • Joined: 2016/03/03 07:23:12
    • Location: belgium
    • Status: offline
    Re: Data initialisation using .data 2020/06/11 02:21:03 (permalink)
    0
    It's in this doc I got lost :-(
    #5
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3992
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: Data initialisation using .data 2020/06/11 05:15:56 (permalink)
    3 (2)
    Data in data memory:
    The data is saved in program memory.
    On runtime, program memory is copied to ram.
    (Initialised variables)
     
     
    Basic constant example:
     
    .include "xc.inc"
    .include "QPrint.inc"
    .globl   qextention_Attribute
    ; ----------------------------------------------------
    .section    .const, psv
    ; ----------------------------------------------------
    Table_Attribute:
    ; ANSI
    .byte   'B'         ; Faint
    .byte   'F'         ; Bold
    .byte   'I'         ; Italic
    .byte   'U'         ; Underline
    .byte   'S'         ; Strike Through
    .byte   'O'         ; Overline
    ; COUT
    .byte   'A'         ; Output to Uppercase
    .byte   'a'         ; Output to Lowercase
    ; ----------------------------------------------------
    .section    QPrint_Extention, code
    ; ----------------------------------------------------

    The table is accessed using psv indirect addressing:
    mov   #Table_Attribute, tbl
    ze      [tbl++], x
    cp.b   x, [string++]

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #6
    Jump to:
    © 2020 APG vNext Commercial Version 4.5