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.

problem with C code for 8051 microcontroller

Status
Not open for further replies.

quris_terris

Junior Member level 3
Joined
May 29, 2005
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,513
i m using this instruction for reading data from P0 of microcontroller.
where P0 is serving as address and data port.

v=XBYTE[0xA000] -128;

where v is any variable . the address 0xA000 is address where no op is present . i generate only this address toactivate my decoder(which is connected to three high bits of address bus) and decoder send data to P0 by activating device(ADC) but data at P0 cannot be read. V has only value ie V=-128
what is the problem ? the assembly code for above statement is is as fallows

MOV DPTR,#0xA000
MOVX A,@DPTR
ADD A,#p0 (0x80)
MOV v(0x30) , A
 

I can't see any C code in your post ..
This section of the assembly code seems to be OK ..
On the other hand, Port P0 in 8051 requires pull-up resistors; something between 4.7kΩ to 10kΩ will do the job. Do you have them installed?
Regards,
IanP
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top