Skip to main content
Visitor II
November 28, 2003
Question

Help me, please, with data Flash paging

  • November 28, 2003
  • 2 replies
  • 545 views
Posted on November 28, 2003 at 11:48

Help me, please, with data Flash paging

    This topic has been closed for replies.

    2 replies

    igorlAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:56

    Hello,

    I have several problems with paging data Flash in uPSD3212, using DK3 Here's it:

    I'm gonna build two generators: one at PB0 and the second at PB1. The code is as follows:

    $include (reg_upsd321x.inc); describe all uPSD registers

    CSEG at 0

    ljmp my_code_s

    code_seg SEGMENT code

    RSEG code_seg

    my_code_s: mov WDKEY,55H; disable watchdog timer

    mov IE,10010101b; enable UART0 interrupt

    mov IEA,00010010b; enable UART1 interrupt

    ;

    mov DPTR,802H; set pointer to a port A mode

    mov A,00H; set data to 0H

    movx @DPTR,A; port A is configured as I/O mode

    ;

    mov DPTR,806H; set pointer to port A direction

    mov A,00001111b; set 4-output and 4 input pins

    movx @DPTR,A; set the port direction register

    ;

    mov DPTR,803H; set pointer to a port B mode

    mov A,00H; set data to 0H

    movx @DPTR,A; port B is configured as I/O mode

    ;

    mov DPTR,807H; set pointer to port B direction

    mov A,0FFH; port B is set as output

    movx @DPTR,A; configure port B

    ;

    label: mov DPTR,8E0H; select page register

    mov A,0H; select the page

    movx @DPTR,A; set page '0' as current page

    call proc;

    mov A,1H;

    movx @DPTR,A; set page '1' as current page

    call proc;

    mov A,2H;

    movx @DPTR,A; set page '2' as current page

    call proc;

    mov A,3H;

    movx @DPTR,A; set page '3' as current page

    call proc;

    ljmp label;

    ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

    proc: mov DPTR,0C000H;

    movx A,@DPTR;

    mov DPTR,805H;

    movx @DPTR,A;

    mov DPTR,8E0H;

    ret

    END

    I use pages 0,1,2 and 3 for paging (bits 0 and 1 in Page register). Data Flashes are difined from C000H up to FFFFH. Thus, I need to load all my data Flash segments with its own data file. I have them for each data Falsh block, thus, I don't need to change addresses in PSDSoft when merging hex-files. My hex-files are generated in the same compiler (Keil) and their textes are:

    for the first hex

    org 0C000H

    DB 00000000b

    END

    for the second hex

    org 0C000H

    DB 00000001b

    END

    for the third hex

    org 0C000H

    DB 00000010b

    END

    and for the fourth hex

    org 0C000H

    DB 00000011b

    END

    When programming, PSDSoft programms all data flash regions.

    Finally, when the program starts, I must see my two generators, where PB0 oscillates two times faster than PB1. Instead of this, I see series of short positive (relatively to negative) pulses at PB0 generator, but PB1 generator is absolutely silent.

    Will you, please, answer, what I do wrong and how shall I do to get the expected result?

    I created this project to learn paging and data flash operations.

    Thank you in advance.

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 11:56

    Quote:

    label: mov DPTR,#8E0H; select page register

    mov A,#0H; select the page

    movx @DPTR,A; set page '0' as current page

    call proc;

    mov A,#1H;

    movx @DPTR,A; set page '1' as current page

    call proc;

    mov A,2H;

    movx @DPTR,A; set page '2' as current page

    call proc;

    mov A,3H;

    movx @DPTR,A; set page '3' as current page

    call proc;

    ljmp label;

    before calling PROC sub, you need to save the data pointer of Page Register, it is changed.