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.

simple program using c8051F120 MCU

Status
Not open for further replies.

robismyname

Full Member level 6
Joined
Jan 17, 2008
Messages
390
Helped
11
Reputation
22
Reaction score
9
Trophy points
1,298
Location
Central Florida
Activity points
4,603
xbr2 = 0xc0

I just want to execute a simple routine using the c8051F120 MCU. I attempted to open port 2 and then enable the crossbar so that my 8 leds hooked up to the port can glow. using this code:

include <c8051F120.h> // SFR declarations
void InitPort()
{
XBR2 = 0xD8; // Enable crossbar and weak pull-up
P2MDOUT |= 0xFF;
}
void main()
{
InitPort();
}

Well it doesn't work!:x

As a sanity check (salvage my self esteem) I attempted to use the c8051F005 MCU and open port 2 and then enable the crossbar so that my 8 leds hooked up to the port can glow. using this code:

#include <c8051F000.h>
void InitPort()
{
XBR2 = 0x40;
PRT2CF |= 0xFF;
}
void main()
{
InitPort();
}

and it worked!

Can anyone help me identify the subtle differences between the two MCU's that are preventing me from succesfully opening the c8051F120 port2?

One thing I noticed and implemented was that (XBR2.4) has to be set to a logic 1 for the 120.


data sheet and such for the c8051f120
https://www.silabs.com/pages/search.aspx?k=C8051F120&searchtypeid=1


data sheet and such for the c8051f005
https://www.silabs.com/pages/search.aspx?k=C8051F005&searchtypeid=1
 

Hi,

/*****************************************
include <c8051F120.h> // SFR declarations
void InitPort()
{
XBR2 = 0xD8; // Enable crossbar and weak pull-up
P2MDOUT |= 0xFF;
}
void main()
{
InitPort();
}
*****************************************/
i think for enabling crossbar & disabling weak pull-up's the register seting is XBR2 = 0xC0;

if u set it as 0xD8, u r routing some port pins to the other peripherals.Check out the Register configuration


Bye.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top