Use

Beep=!Beep;

instead of ~. Otherwise C converts bit Beep to integer, makes bit complement and converts the result back to bit, what produces wrong result.

Ondrej

 

 

 

From: JIA Pei [mailto:jp4work@gmail.com]
Sent: Saturday, June 08, 2013 5:45 PM
To: sdcc-user@lists.sourceforge.net
Subject: Re: [Sdcc-user] buzzer code is working properly on my board built from Keil C51, but doesn't work at all if built from sdcc ...

 

Hi, Thank you Ma XiaoJun.

 

I tried

1)

#include <reg51.h>    

 sbit Beep =  P1_5 ; 

 

which is wrong

 

2)

#include <reg51.h>

sbit Beep;

....

Beep=~Beep;

 

which is wrong

 

3)

#include <reg51.h>

// sbit Beep =  P1_5 ; 

...

P1_5=~P1_5;

 

which is still wrong

 

 

 

I should say "thank you" to you, but your answer didn't give out a clear solution. 

Isn't there a way out to solve such problems in sdcc???

 

 

 

Cheers

 

 

 

 

 

 

 

 

 

On Sat, Jun 8, 2013 at 8:36 PM, Ma Xiaojun <damage3025@gmail.com> wrote:

RTFM

The following line is invalid in SDCC. SDCC uses different syntax.
sbit Beep =  P1^5 ;


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user



 

--

 

Pei JIA

 

Email: jp4work@gmail.com

cell:    +1 604-362-5816

 

Welcome to Vision Open
http://www.visionopen.com