This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

'Segment Code address' out of range when programming AT89C2051 with µvision2

Hello,

I try to program a AT89C2051 with Keil µvision2.

Every time I run the 'Built Target' my assembly code starts at 0800h, Outside the characteristics of the proc.

How to tell µvision to start a lower address in the range 0 to 07FFh.

I enclose the beginning of the code initializing the various segments related to programming.

In advance thank you very much!

P.Buton


#include <reg51.inc>    ; définition des registres SFR du µC 8051

; Description du port P1
;
;       P1.0 :  Led indiquant une activation du poussoir (allumé pendant tout le cycle)
;       P1.1 :  Buzzer, activation par mise à 1
;       P1.2 :  Led de contrôle, idem buzzer
;       P1.3 :
;       P1.4 :
;       P1.5 :
;       P1.6 :
;       P1.7 :
;
; Description des registres
;
;       R7      tests anti-rebond, validé à 5 (5 fois 2ms)
;
;----------------------------------------------------------------------------------------------
; DATA SEGMENT--Reserves space in DATA RAM--Delete this segment if not used.
;----------------------------------------------------------------------------------------------
data_seg_name   SEGMENT DATA                    ; segment for DATA RAM.
                RSEG    data_seg_name           ; switch to this data segment;

BCL_0:          DS      1                       ; nombre de boucles tempo 0 de 50ms
BCL_1:          DS      1                       ; nombre de boucles tempo 1 de 50ms

;----------------------------------------------------------------------------------------------
; BIT SEGMENT--Reserves space in BIT RAM--Delete segment if not used.
;----------------------------------------------------------------------------------------------
bit_seg_name    SEGMENT BIT                     ; segment for BIT RAM.
                RSEG    bit_seg_name            ; switch to this bit segment

ACTION:         DBIT    1                       ; validation de l'action du poussoir
TEMP_0:         DBIT    1                       ; validation de la tempo timer 0
TEMP_1:         DBIT    1                       ; validation de la tempo timer 1
REBOND:         DBIT    1                       ; tempo anti-rebond
ATTENTE:        DBIT    1                       ; tempo d'attente avant avertissement
FRONT:          DBIT    1                       ; battement front positif

;----------------------------------------------------------------------------------------------
; Add constant (typeless) numbers here.
;----------------------------------------------------------------------------------------------
;
; temporisations avec un quartz de 12 mhz
;

NB_REBOND       EQU     5                       ; nombre de tests anti-rebond
TEMPO_2MS_H     EQU     0F8H                    ; tempo 2ms
TEMPO_2MS_L     EQU     08FH
TEMPO_50MS_H    EQU     04BH                    ;tempo 50ms
TEMPO_50MS_L    EQU     0FDH
TEMPO_100MS     EQU     2                       ; tempo 100ms
TEMPO_500MS     EQU     10                      ; tempo 500ms
TEMPO_2S        EQU     40                      ; tempo 2s
TEMPO_5S        EQU     100                     ; tempo 5s

;----------------------------------------------------------------------------------------------
; -- Debugging with Monitor-51 needs                 -- NE PAS DETRUIRE
;----------------------------------------------------------------------------------------------
                DSEG    AT      0x23
RESERVE:        DS      3

;----------------------------------------------------------------------------------------------
; STACK SEGMENT--Reserves space for STACK            -- NE PAS DETRUIRE
;----------------------------------------------------------------------------------------------
STACK           SEGMENT IDATA                   ; Segment pour la pile
                RSEG    STACK
                DS      32                      ; Taille de la pile

;----------------------------------------------------------------------------------------------
; Provide an LJMP to start at the reset address (address 0) in the main module.
; You may use this style for interrupt service routines.
;----------------------------------------------------------------------------------------------

                CSEG    AT 0                    ; absolute Segment at Address 0
                LJMP    Start                   ; début du programme après reset
                ORG     03H                     ; @ interruption externe 0 (poussoir)
                LJMP    Int_ext0
                ORG     0BH                     ; @ interruption timer 0 (durées)
                LJMP    Int_timer0
                ORG     01BH                    ; interruption timer 1 (battements)
                LJMP    Int_timer1

;----------------------------------------------------------------------------------------------
; CODE SEGMENT--Reserves space in CODE ROM for assembler instructions.
;----------------------------------------------------------------------------------------------

PROG            SEGMENT CODE
                RSEG    PROG                    ; switch to this code segment
                USING   0                       ; state register_bank used for the following program code
Start:          MOV     SP,#STACK-1             ; assign stack at beginning

;----------------------------------------------------------------------------------------------
; Insert your assembly program here.
;----------------------------------------------