#60 about sdcc

closed
Maarten Brock
None
5
2014-12-25
2007-04-22
huang_12345yong
No

Hi,
I am a chinese software engineer.Recently,I used SDCC to
instead of Keil C .I wtote a simple
program to test SDCC,but,I met problem. Can you give me
some advice?
My program is below.

/***********************************************************
******/
Example1: main.c
#inclued<8051.h>
void mian (void)
{
p0_1=1;
p0_2=1;
while(1)
{
p0_3=1;
n_delay(5);delay 5ms
p0_3=0;
n_delay(5);delay 5ms
}

I compile it using SDCC.
sdcc main.c
packeihx main.ihx > main.hex

problem: I put the hex file into MSC51 ROM and observe
p0_1,p0_2 by oscillograph.
I find out p0_1 = 0, p0_2 =0;but p0_3 is as my
mind.
this problem puzzles me, so I write second problem

Example2: main.c
#inclued<8051.h>
void mian (void)
{
//p0_1=1;
//p0_2=1;
while(1)
{
// p0_3=1;
n_delay(5);delay 5ms
// p0_3=0;
n_delay(5);delay 5ms
}

I compile it using SDCC.
sdcc main.c
packeihx main.ihx > main.hex

problem: I put the hex file into MSC51 ROM and observe
p0_1,p0_2 ,p0_3 by oscillograph.
I find out p0_1 = 0, p0_2 =0; p0_3 = 0; I don't
know why I meet this problem?
I don't operate p0_1 p0_2 p0_3 .
Normally, the p0_1,p0_2,p0_3 must be pulled
up,but here the p0_1,p0_2,p0_3 is pulled down.

I also use keil c to compile above two programs and run
them .
every program is ok.

/***********************************************************
******/

whish your reply.
I'm so sorry about my poor english.

Best Regards

Discussion

  • Maarten Brock
    Maarten Brock
    2007-04-22

    Logged In: YES
    user_id=888171
    Originator: NO

    Hi Huang,

    This looks more like a support request and I therefor move it that tracker category. I'm glad you logged in so you will be notified of this and do not have to wonder where your item went when you come back.

    I think you retyped your code instead of using copy/paste. It contains many typo's and will not compile with any compiler. You also did not show n_delay(). Please copy/paste all (relevant) code or upload and attach it to this tracker item (another advantage of being logged in).

    If you're using an Intel 8051 or one of the close derivatives (you did not tell), did you put pullups on P0? Otherwise they are floating when set to '1'.

    Greetings,
    Maarten

     
  • Maarten Brock
    Maarten Brock
    2007-04-22

    • labels: 101550 -->
     
  • Maarten Brock
    Maarten Brock
    2008-04-18

    • assigned_to: nobody --> maartenbrock
    • status: open --> closed