Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[51] Maxim DS89C450 MCU - not responding to C code

Status
Not open for further replies.

PsySc0rpi0n

Newbie level 4
Newbie level 4
Joined
Oct 5, 2014
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
43
Hello everyone...

I'm new here and I need some help.

I'm studying Electronics Engineering and we are working with an 8051 compatible MCU which is DS89C450 from Maxim.

The problem I'm facing is that my MCU accepts any ASM code but can't make it work with any C code.

I'm using MCU8051IDE with SDCC behind it to compile my codes.

Here is an example of ASM code working:
Code:
main:
MOV P1,#00h
CLR P3.5
CLR P3.6
CLR P3.7
ACALL delay
CPL P3.5
ACALL delay
CPL P3.6
ACALL delay
CPL P3.7
ACALL delay
MOV A,P1
CPL A
MOV P1,A
ACALL delay
SJMP main

delay:
    loopcon:MOV R5,#0Ah
    loopext:MOV R7,#0B4h
    loopint:MOV R6,#0FFh
            DJNZ R6,$
            DJNZ R7,loopint
            DJNZ R5,loopext
RET
END

And here is some non working C code:

Code:
#include "reg_uC89C4xx.h"

void delay_msec (unsigned int msec) {
    while (msec--){
        TMOD = 0x01;
        TH0  = 0xFD;
        TL0  = 0x4B;
        TF0  = 0x00;
        TR0  = 0x01;
        while (!TF0);
        TF0  = 0x00;
        TR0  = 0x00;
    }
}

void main (void) {
    while (0x01){
        P1 = 0xFF;
        delay_msec (0x01F4);
        P1 = 0x00;
        delay_msec (0x01F4);
    }
}

So this moment I only have 8 LEDs connected to Port P1 and 3 more connected to P3.5, P3.6 and P3.7 just to check if everything was ok.

But with C code I can't do anything. LEDs just doesn't respond to any C code!
Any help is appreciated.

Thanks
Psy
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top